Skip to content

Commit

Permalink
Refactor interfaces and engine code (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
wild-endeavor authored Sep 14, 2020
1 parent 2bd8b17 commit fd57a48
Show file tree
Hide file tree
Showing 234 changed files with 1,146 additions and 1,251 deletions.
19 changes: 17 additions & 2 deletions flytekit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
from __future__ import absolute_import
import logging as _logging

import flytekit.plugins # noqa: F401

__version__ = "0.12.6"
__version__ = "0.13.0b4"

logger = _logging.getLogger("flytekit")

# create console handler and set level to debug
ch = _logging.StreamHandler()
ch.setLevel(_logging.DEBUG)

# create formatter
formatter = _logging.Formatter("%(asctime)s-%(name)s-%(levelname)s$ %(message)s")

# add formatter to ch
ch.setFormatter(formatter)

# add ch to logger
logger.addHandler(ch)
2 changes: 0 additions & 2 deletions flytekit/bin/entrypoint.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import datetime as _datetime
import importlib as _importlib
import os as _os
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clients/friendly.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import six as _six
from flyteidl.admin import common_pb2 as _common_pb2
from flyteidl.admin import execution_pb2 as _execution_pb2
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clients/raw.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import logging as _logging

import six as _six
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/auth/credentials.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import logging as _logging
import urllib.parse as _urlparse

Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/flyte_cli/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import importlib as _importlib
import os as _os
import stat as _stat
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import six as _six

from flytekit.common.types.helpers import get_sdk_type_from_literal_type as _get_sdk_type_from_literal_type
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/sdk_in_container/basic_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import base64 as _base64
import logging as _logging

Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/sdk_in_container/launch_plan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import logging as _logging

import click
Expand Down
8 changes: 1 addition & 7 deletions flytekit/clis/sdk_in_container/pyflyte.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
from __future__ import absolute_import, print_function

import logging as _logging
import os as _os
from pathlib import Path

import click

try:
from pathlib import Path
except ImportError:
from pathlib2 import Path # python 2 backport

from flytekit.clis.sdk_in_container.constants import CTX_DOMAIN, CTX_PACKAGES, CTX_PROJECT, CTX_VERSION
from flytekit.clis.sdk_in_container.launch_plan import launch_plans
from flytekit.clis.sdk_in_container.register import register
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/sdk_in_container/register.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import logging as _logging

import click
Expand Down
2 changes: 0 additions & 2 deletions flytekit/clis/sdk_in_container/serialize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, print_function

import logging as _logging
import math as _math
import os as _os
Expand Down
8 changes: 2 additions & 6 deletions flytekit/common/component_nodes.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from __future__ import absolute_import

import logging as _logging

import six as _six

from flytekit.common import sdk_bases as _sdk_bases
from flytekit.common.exceptions import system as _system_exceptions
from flytekit.models.core import workflow as _workflow_model


class SdkTaskNode(_six.with_metaclass(_sdk_bases.ExtendedSdkType, _workflow_model.TaskNode)):
class SdkTaskNode(_workflow_model.TaskNode, metaclass=_sdk_bases.ExtendedSdkType):
def __init__(self, sdk_task):
"""
:param flytekit.common.tasks.task.SdkTask sdk_task:
Expand Down Expand Up @@ -60,7 +56,7 @@ def promote_from_model(cls, base_model, tasks):
return cls(sdk_task)


class SdkWorkflowNode(_six.with_metaclass(_sdk_bases.ExtendedSdkType, _workflow_model.WorkflowNode)):
class SdkWorkflowNode(_workflow_model.WorkflowNode, metaclass=_sdk_bases.ExtendedSdkType):
def __init__(self, sdk_workflow=None, sdk_launch_plan=None):
"""
:param flytekit.common.workflow.SdkWorkflow sdk_workflow:
Expand Down
2 changes: 0 additions & 2 deletions flytekit/common/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

INPUT_FILE_NAME = "inputs.pb"
OUTPUT_FILE_NAME = "outputs.pb"
FUTURES_FILE_NAME = "futures.pb"
Expand Down
12 changes: 3 additions & 9 deletions flytekit/common/core/identifier.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from __future__ import absolute_import

import six as _six

from flytekit.common import sdk_bases as _sdk_bases
from flytekit.common.exceptions import user as _user_exceptions
from flytekit.models.core import identifier as _core_identifier


class Identifier(_six.with_metaclass(_sdk_bases.ExtendedSdkType, _core_identifier.Identifier)):
class Identifier(_core_identifier.Identifier, metaclass=_sdk_bases.ExtendedSdkType):

_STRING_TO_TYPE_MAP = {
"lp": _core_identifier.ResourceType.LAUNCH_PLAN,
Expand Down Expand Up @@ -61,9 +59,7 @@ def __str__(self):
)


class WorkflowExecutionIdentifier(
_six.with_metaclass(_sdk_bases.ExtendedSdkType, _core_identifier.WorkflowExecutionIdentifier)
):
class WorkflowExecutionIdentifier(_core_identifier.WorkflowExecutionIdentifier, metaclass=_sdk_bases.ExtendedSdkType):
@classmethod
def promote_from_model(cls, base_model):
"""
Expand Down Expand Up @@ -101,9 +97,7 @@ def __str__(self):
return "ex:{}:{}:{}".format(self.project, self.domain, self.name)


class TaskExecutionIdentifier(
_six.with_metaclass(_sdk_bases.ExtendedSdkType, _core_identifier.TaskExecutionIdentifier)
):
class TaskExecutionIdentifier(_core_identifier.TaskExecutionIdentifier, metaclass=_sdk_bases.ExtendedSdkType):
@classmethod
def promote_from_model(cls, base_model):
"""
Expand Down
7 changes: 1 addition & 6 deletions flytekit/common/exceptions/base.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from __future__ import absolute_import

import six as _six


class _FlyteCodedExceptionMetaclass(type):
@property
def error_code(cls):
return cls._ERROR_CODE


class FlyteException(_six.with_metaclass(_FlyteCodedExceptionMetaclass, Exception)):
class FlyteException(Exception, metaclass=_FlyteCodedExceptionMetaclass):
_ERROR_CODE = "UnknownFlyteException"


Expand Down
2 changes: 0 additions & 2 deletions flytekit/common/exceptions/scopes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from sys import exc_info as _exc_info
from traceback import format_tb as _format_tb

Expand Down
2 changes: 0 additions & 2 deletions flytekit/common/exceptions/system.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from flytekit.common.exceptions import base as _base_exceptions


Expand Down
2 changes: 0 additions & 2 deletions flytekit/common/exceptions/user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from flytekit.common.exceptions.base import FlyteException as _FlyteException
from flytekit.common.exceptions.base import FlyteRecoverableException as _Recoverable

Expand Down
6 changes: 2 additions & 4 deletions flytekit/common/interface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import six as _six

from flytekit.common import promise as _promise
Expand All @@ -12,7 +10,7 @@
from flytekit.models import literals as _literal_models


class BindingData(_six.with_metaclass(_sdk_bases.ExtendedSdkType, _literal_models.BindingData)):
class BindingData(_literal_models.BindingData, metaclass=_sdk_bases.ExtendedSdkType):
@staticmethod
def _has_sub_bindings(m):
"""
Expand Down Expand Up @@ -96,7 +94,7 @@ def from_python_std(cls, literal_type, t_value, upstream_nodes=None):
return cls(scalar=scalar, collection=collection, map=map, promise=promise)


class TypedInterface(_six.with_metaclass(_sdk_bases.ExtendedSdkType, _interface_models.TypedInterface)):
class TypedInterface(_interface_models.TypedInterface, metaclass=_sdk_bases.ExtendedSdkType):
@classmethod
def promote_from_model(cls, model):
"""
Expand Down
Loading

0 comments on commit fd57a48

Please sign in to comment.