Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK - Relative imports #156

Merged
merged 1 commit into from
Nov 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/python/kfp/compiler/_component_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import logging
from google.cloud import storage
from pathlib import PurePath, Path
from kfp import dsl
from kfp.components._components import _create_task_factory_from_component_dict
from .. import dsl
from ..components._components import _create_task_factory_from_component_dict
from ._k8s_helper import K8sHelper

class GCSHelper(object):
Expand Down
3 changes: 2 additions & 1 deletion sdk/python/kfp/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
from collections import defaultdict
import copy
import inspect
import kfp.dsl as dsl
import re
import string
import tarfile
import tempfile
import yaml

from .. import dsl


class Compiler(object):
"""DSL Compiler.
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/components/_dsl_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
_dummy_pipeline=None

def _create_task_object(name:str, container_image:str, command=None, arguments=None, file_inputs=None, file_outputs=None):
import kfp.dsl as dsl
from .. import dsl
global _dummy_pipeline
need_dummy = dsl.Pipeline._default_pipeline is None
if need_dummy:
Expand Down
7 changes: 3 additions & 4 deletions sdk/python/kfp/dsl/_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from kfp import dsl
def python_component(name, description, base_image):
"""Decorator of component functions.

Expand All @@ -28,7 +27,7 @@ def my_component(a: str, b: int) -> str:
```
"""
def _python_component(func):
dsl.PythonComponent.add_python_component(name, description, base_image, func)
PythonComponent.add_python_component(name, description, base_image, func)
return func

return _python_component
Expand All @@ -50,7 +49,7 @@ class PythonComponent():
@staticmethod
def add_python_component(name, description, base_image, func):
""" Add a python component """
dsl.PythonComponent._component_functions[func] = {
PythonComponent._component_functions[func] = {
'name': name,
'description': description,
'base_image': base_image
Expand All @@ -59,4 +58,4 @@ def add_python_component(name, description, base_image, func):
@staticmethod
def get_python_component(func):
""" Get a python component """
return dsl.PythonComponent._component_functions.get(func, None)
return PythonComponent._component_functions.get(func, None)
2 changes: 1 addition & 1 deletion sdk/python/kfp/notebook/_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
raise Exception('This module can only be loaded in Jupyter.')


from kfp.compiler import build_docker_image
import os
import tempfile
from ..compiler import build_docker_image


@IPython.core.magic.register_cell_magic
Expand Down