예제 #1
0
    def testDeprecationAliasFunction(self, mock_absl_warning):
        # By default, we warn once across all calls.
        my_function_1 = self._mock_function()
        deprecation_alias_1 = deprecation_utils.deprecated_alias(
            'deprecation_alias_1', 'my_function_1', my_function_1)
        deprecation_alias_1()
        deprecation_alias_1()
        mock_absl_warning.assert_called_once_with(mock.ANY, mock.ANY,
                                                  'deprecation_alias_1',
                                                  'my_function_1')
        self.assertEqual(my_function_1.call_count, 2)
        mock_absl_warning.reset_mock()

        # If `warn_once=False`, we warn once for each call.
        my_function_2 = self._mock_function()
        deprecation_alias_2 = deprecation_utils.deprecated_alias(
            'deprecation_alias_2',
            'my_function_2',
            my_function_2,
            warn_once=False)
        deprecation_alias_2()
        deprecation_alias_2()
        deprecation_alias_2()
        self.assertEqual(mock_absl_warning.call_count, 3)
        self.assertEqual(my_function_2.call_count, 3)
        mock_absl_warning.reset_mock()
예제 #2
0
    def testDeprecationAliasFunction(self):
        # By default, we warn once across all calls.
        my_function_1 = self._mock_function(name='my_function_1')
        deprecation_alias_1 = deprecation_utils.deprecated_alias(
            'deprecation_alias_1', 'my_function_1', my_function_1)
        deprecation_alias_1()
        deprecation_alias_1()
        self._assertDeprecatedWarningRegex(
            'From .*: The name deprecation_alias_1 is deprecated. Please use '
            'my_function_1 instead.')
        self.assertEqual(my_function_1.call_count, 2)
        self._mock_warn.reset_mock()

        # If `warn_once=False`, we warn once for each call.
        my_function_2 = self._mock_function()
        deprecation_alias_2 = deprecation_utils.deprecated_alias(
            'deprecation_alias_2',
            'my_function_2',
            my_function_2,
            warn_once=False)
        deprecation_alias_2()
        deprecation_alias_2()
        deprecation_alias_2()
        self.assertEqual(self._mock_warn.call_count, 3)
        self.assertEqual(my_function_2.call_count, 3)
예제 #3
0
    def testDeprecationClass(self, mock_absl_warning):
        class MyClass1(object):
            __init__ = mock.MagicMock()

        class MyClass2(object):
            __init__ = mock.MagicMock()

        # By default, we warn once across all calls.
        DeprecatedAliasClass1 = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
            'DeprecatedAliasClass1', 'MyClass1', MyClass1)
        DeprecatedAliasClass1()
        DeprecatedAliasClass1()
        mock_absl_warning.assert_called_once_with(mock.ANY, mock.ANY,
                                                  'DeprecatedAliasClass1',
                                                  'MyClass1')
        self.assertEqual(MyClass1.__init__.call_count, 2)
        mock_absl_warning.reset_mock()

        # Check properties of the deprecated class.
        self.assertEqual(DeprecatedAliasClass1._TFX_DEPRECATED_CLASS, True)
        self.assertEqual(
            repr(DeprecatedAliasClass1.__doc__),
            repr("""DEPRECATED CLASS

Warning: THIS CLASS IS DEPRECATED. It will be removed in a future version.
Please use MyClass1 instead."""))

        # If `warn_once=False`, we warn once for each call.
        DeprecatedAliasClass2 = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
            'DeprecatedAliasClass2',
            'MyClass2',
            MyClass2,
            warn_once=False)
        DeprecatedAliasClass2()
        DeprecatedAliasClass2()
        DeprecatedAliasClass2()
        self.assertEqual(mock_absl_warning.call_count, 3)
        self.assertEqual(MyClass2.__init__.call_count, 3)
        mock_absl_warning.reset_mock()
예제 #4
0
    def testDeprecationClass(self):
        class MyClass1:
            __init__ = mock.MagicMock()

        class MyClass2:
            __init__ = mock.MagicMock()

        # By default, we warn once across all calls.
        DeprecatedAliasClass1 = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
            'DeprecatedAliasClass1', 'MyClass1', MyClass1)
        DeprecatedAliasClass1()
        DeprecatedAliasClass1()
        self._assertDeprecatedWarningRegex(
            'From .*: The name DeprecatedAliasClass1 is deprecated. Please use '
            'MyClass1 instead.')
        self.assertEqual(MyClass1.__init__.call_count, 2)
        self._mock_warn.reset_mock()

        # Check properties of the deprecated class.
        self.assertEqual(DeprecatedAliasClass1.__name__, '_NewDeprecatedClass')
        self.assertEqual(
            repr(DeprecatedAliasClass1.__doc__),
            repr("""DEPRECATED CLASS

Warning: THIS CLASS IS DEPRECATED. It will be removed in a future version.
Please use MyClass1 instead."""))

        # If `warn_once=False`, we warn once for each call.
        DeprecatedAliasClass2 = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
            'DeprecatedAliasClass2',
            'MyClass2',
            MyClass2,
            warn_once=False)
        DeprecatedAliasClass2()
        DeprecatedAliasClass2()
        DeprecatedAliasClass2()
        self.assertEqual(self._mock_warn.call_count, 3)
        self.assertEqual(MyClass2.__init__.call_count, 3)
예제 #5
0
def _make_deprecated_resolver_node_alias():
    """Make ResolverNode alias class.

  Make the deprecation shim for ResolverNode.  Needed to conform to the
  convention expected by `tfx.utils.deprecation_utils` and to translate renamed
  constructor arguments.

  Returns:
      Deprecated ResolverNode alias class.
  """
    parent_deprecated_class = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
        deprecated_name=
        'tfx.components.common_nodes.resolver_node.ResolverNode',
        name='tfx.dsl.components.common.resolver.Resolver',
        func_or_class=resolver.Resolver)

    class _NewDeprecatedClass(parent_deprecated_class):
        """Deprecated ResolverNode alias constructor.

    This class location is DEPRECATED and is provided temporarily for
    compatibility. Please use `tfx.dsl.components.common.resolver.Resolver`
    instead.
    """
        def __init__(self,
                     instance_name: Text,
                     resolver_class: Type[resolver.ResolverStrategy],
                     resolver_configs: Dict[Text,
                                            json_utils.JsonableType] = None,
                     **kwargs: types.Channel):
            """Forwarding shim for deprecated ResolverNode alias constructor.

      Args:
        instance_name: the name of the Resolver instance.
        resolver_class: a ResolverStrategy subclass which contains the artifact
          resolution logic.
        resolver_configs: a dict of key to Jsonable type representing
          configuration that will be used to construct the resolver strategy.
        **kwargs: a key -> Channel dict, describing what are the Channels to be
          resolved. This is set by user through keyword args.
      """
            super(ResolverNode, self).__init__(instance_name=instance_name,
                                               strategy_class=resolver_class,
                                               config=resolver_configs,
                                               **kwargs)

    return _NewDeprecatedClass
예제 #6
0
class KubeflowV2DagRunner(tfx_runner.TfxRunner):
    """Kubeflow V2 pipeline runner.

  Builds a pipeline job spec in json format based on TFX pipeline DSL object.
  """
    def __init__(self,
                 config: KubeflowV2DagRunnerConfig,
                 output_dir: Optional[Text] = None,
                 output_filename: Optional[Text] = None):
        """Constructs an KubeflowV2DagRunner for compiling pipelines.

    Args:
      config: An KubeflowV2DagRunnerConfig object to specify runtime
        configuration when running the pipeline in Kubeflow.
      output_dir: An optional output directory into which to output the pipeline
        definition files. Defaults to the current working directory.
      output_filename: An optional output file name for the pipeline definition
        file. The file output format will be a JSON-serialized PipelineJob pb
        message. Defaults to 'pipeline.json'.
    """
        if not isinstance(config, KubeflowV2DagRunnerConfig):
            raise TypeError(
                'config must be type of KubeflowV2DagRunnerConfig.')
        super(KubeflowV2DagRunner, self).__init__()
        self._config = config
        self._output_dir = output_dir or os.getcwd()
        self._output_filename = output_filename or 'pipeline.json'

    def run(self,
            pipeline: tfx_pipeline.Pipeline,
            parameter_values: Optional[Dict[Text, Any]] = None,
            write_out: Optional[bool] = True) -> Dict[Text, Any]:
        """Compiles a pipeline DSL object into pipeline file.

    Args:
      pipeline: TFX pipeline object.
      parameter_values: mapping from runtime parameter names to its values.
      write_out: set to True to actually write out the file to the place
        designated by output_dir and output_filename. Otherwise return the
        JSON-serialized pipeline job spec.

    Returns:
      Returns the JSON pipeline job spec.

    Raises:
      RuntimeError: if trying to write out to a place occupied by an existing
      file.
    """
        # TODO(b/166343606): Support user-provided labels.
        # TODO(b/169095387): Deprecate .run() method in favor of the unified API
        # client.
        display_name = (self._config.display_name
                        or pipeline.pipeline_info.pipeline_name)
        pipeline_spec = pipeline_builder.PipelineBuilder(
            tfx_pipeline=pipeline,
            default_image=self._config.default_image,
            default_commands=self._config.default_commands).build()
        pipeline_spec.sdk_version = 'tfx-{}'.format(version.__version__)
        pipeline_spec.schema_version = _SCHEMA_VERSION
        runtime_config = pipeline_builder.RuntimeConfigBuilder(
            pipeline_info=pipeline.pipeline_info,
            parameter_values=parameter_values).build()
        with telemetry_utils.scoped_labels(
            {telemetry_utils.LABEL_TFX_RUNNER: 'kubeflow_v2'}):
            result = pipeline_pb2.PipelineJob(
                display_name=display_name
                or pipeline.pipeline_info.pipeline_name,
                labels=telemetry_utils.get_labels_dict(),
                runtime_config=runtime_config)
        result.pipeline_spec.update(json_format.MessageToDict(pipeline_spec))
        pipeline_json_dict = json_format.MessageToDict(result)
        if write_out:
            if fileio.exists(
                    self._output_dir) and not fileio.isdir(self._output_dir):
                raise RuntimeError('Output path: %s is pointed to a file.' %
                                   self._output_dir)
            if not fileio.exists(self._output_dir):
                fileio.makedirs(self._output_dir)

            with fileio.open(
                    os.path.join(self._output_dir, self._output_filename),
                    'wb') as f:
                f.write(json.dumps(pipeline_json_dict, sort_keys=True))

        return pipeline_json_dict

    compile = deprecation_utils.deprecated_alias(deprecated_name='compile',
                                                 name='run',
                                                 func_or_class=run)
예제 #7
0
from tfx.components.trainer import constants
from tfx.components.trainer import fn_args_utils
from tfx.components.util import udf_utils
from tfx.dsl.components.base import base_executor
from tfx.dsl.io import fileio
from tfx.types import artifact_utils
from tfx.utils import deprecation_utils
from tfx.utils import io_utils
from tfx.utils import path_utils

from tensorflow.python.lib.io import file_io  # pylint: disable=g-direct-tensorflow-import
from tensorflow_metadata.proto.v0 import schema_pb2


TrainerFnArgs = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.trainer.executor.TrainerFnArgs',
    name='tfx.components.trainer.fn_args_utils.FnArgs',
    func_or_class=fn_args_utils.FnArgs)


def _all_files_pattern(file_pattern: Text) -> Text:
  return os.path.join(file_pattern, '*')


def _is_chief():
  """Returns true if this is run in the master (chief) of training cluster."""
  tf_config = json.loads(os.environ.get(constants.TF_CONFIG_ENV) or '{}')

  # If non distributed mode, current process should always behave as chief.
  if not tf_config or not tf_config.get('cluster', {}):
    return True
예제 #8
0
# Lint as: python2, python3
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Deprecated definition of Airflow TFX runner."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tfx.orchestration.airflow import airflow_dag_runner
from tfx.utils import deprecation_utils

AirflowDAGRunner = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='airflow_runner.AirflowDAGRunner',
    name='airflow_dag_runner.AirflowDagRunner',
    func_or_class=airflow_dag_runner.AirflowDagRunner)
예제 #9
0
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Base class for TFX resolvers."""

from tfx.dsl.components.common import resolver
from tfx.utils import deprecation_utils

ResolveResult = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.dsl.components.common.resolver.ResolveResult',
    name='tfx.dsl.resolvers.base_resolver.ResolveResult',
    func_or_class=resolver.ResolveResult)

BaseResolver = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.dsl.components.common.resolver.ResolverStrategy',
    name='tfx.dsl.resolvers.base_resolver.BaseResolver',
    func_or_class=resolver.ResolverStrategy)
예제 #10
0
파일: cmle_runner.py 프로젝트: jay90099/tfx
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Deprecated definition of runner to start TFX training jobs on CMLE."""

from tfx.extensions.google_cloud_ai_platform import runner
from tfx.utils import deprecation_utils

start_cmle_training = deprecation_utils.deprecated_alias(
    deprecated_name='cmle_runner.start_cmle_training',
    name='runner.start_cloud_training',
    func_or_class=runner.start_cloud_training)
deploy_model_for_cmle_serving = deprecation_utils.deprecated_alias(
    deprecated_name='cmle_runner.deploy_model_for_cmle_serving',
    name='runner.deploy_model_for_aip_prediction',
    func_or_class=runner.deploy_model_for_aip_prediction)
예제 #11
0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Stub for pre-rename `tfx.dsl.components.base.executor_spec`."""

from tfx.dsl.components.base import executor_spec
from tfx.utils import deprecation_utils

ExecutorSpec = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.executor_spec.ExecutorSpec',
    name='tfx.dsl.components.base.executor_spec.ExecutorSpec',
    func_or_class=executor_spec.ExecutorSpec)

ExecutorClassSpec = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.executor_spec.ExecutorClassSpec',
    name='tfx.dsl.components.base.executor_spec.ExecutorClassSpec',
    func_or_class=executor_spec.ExecutorClassSpec)

ExecutorContainerSpec = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.executor_spec.ExecutorContainerSpec',
    name='tfx.dsl.components.base.executor_spec.ExecutorContainerSpec',
    func_or_class=executor_spec.ExecutorContainerSpec)
예제 #12
0
파일: base_node.py 프로젝트: vikrosj/tfx
# Lint as: python2, python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Stub for pre-rename `tfx.dsl.components.base.base_node`."""

# TODO(b/149535307): Remove __future__ imports
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tfx.dsl.components.base import base_node
from tfx.utils import deprecation_utils

BaseNode = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.base_node.BaseNode',
    name='tfx.dsl.components.base.base_node.BaseNode',
    func_or_class=base_node.BaseNode)
예제 #13
0
파일: runner.py 프로젝트: vikrosj/tfx
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Deprecated definition of Kubeflow TFX runner."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tfx.orchestration.kubeflow import kubeflow_dag_runner
from tfx.utils import deprecation_utils

KubeflowRunner = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='runner.KubeflowRunner',
    name='kubeflow_dag_runner.KubeflowDagRunner',
    func_or_class=kubeflow_dag_runner.KubeflowDagRunner)
KubeflowRunnerConfig = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='runner.KubeflowRunnerConfig',
    name='kubeflow_dag_runner.KubeflowDagRunnerConfig',
    func_or_class=kubeflow_dag_runner.KubeflowDagRunnerConfig)
예제 #14
0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Stub for pre-rename `tfx.dsl.components.base.base_executor`."""

# TODO(b/149535307): Remove __future__ imports
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tfx.dsl.components.base import base_executor
from tfx.utils import deprecation_utils

BaseExecutor = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.base_executor.BaseExecutor',
    name='tfx.dsl.components.base.base_executor.BaseExecutor',
    func_or_class=base_executor.BaseExecutor)

EmptyExecutor = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.base_executor.EmptyExecutor',
    name='tfx.dsl.components.base.base_executor.EmptyExecutor',
    func_or_class=base_executor.EmptyExecutor)
예제 #15
0
import tensorflow as tf
from tfx.proto import trainer_pb2
from tfx.utils import deprecation_utils
from tfx.utils import json_utils


class _DefaultJsonableObject(json_utils.Jsonable):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c


_DeprecatedAlias = deprecation_utils.deprecated_alias(
    deprecated_name='_DeprecatedAlias',
    name='_DefaultJsonableObject',
    func_or_class=_DefaultJsonableObject)


class JsonUtilsTest(tf.test.TestCase):
    def testDumpsJsonableObjectRoundtrip(self):
        obj = _DefaultJsonableObject(1, {'a': 'b'}, [True])

        json_text = json_utils.dumps(obj)

        actual_obj = json_utils.loads(json_text)
        self.assertEqual(1, actual_obj.a)
        self.assertDictEqual({'a': 'b'}, actual_obj.b)
        self.assertCountEqual([True], actual_obj.c)

    def testDumpsNestedJsonableObject(self):
예제 #16
0
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Experimental Resolver for getting the artifacts based on Span."""

from tfx.dsl.input_resolution.strategies import span_range_strategy
from tfx.utils import deprecation_utils

SpansResolver = deprecation_utils.deprecated_alias(
    'tfx.dsl.experimental.spans_resolver.SpansResolver',
    'tfx.dsl.input_resolution.strategies.span_range_strategy.SpanRangeStrategy',
    span_range_strategy.SpanRangeStrategy)
예제 #17
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Deprecated location for the TFX ImporterNode.

The new location is `tfx.dsl.components.common.importer_node.ImporterNode`.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tfx.dsl.components.common import importer_node
from tfx.utils import deprecation_utils

# Constant to access importer importing result from importer output dict.
IMPORT_RESULT_KEY = importer_node.IMPORT_RESULT_KEY
# Constant to access artifact uri from importer exec_properties dict.
SOURCE_URI_KEY = importer_node.SOURCE_URI_KEY
# Constant to access artifact properties from importer exec_properties dict.
PROPERTIES_KEY = importer_node.PROPERTIES_KEY
# Constant to access artifact properties from importer exec_properties dict.
CUSTOM_PROPERTIES_KEY = importer_node.CUSTOM_PROPERTIES_KEY
# Constant to access re-import option from importer exec_properties dict.
REIMPORT_OPTION_KEY = importer_node.REIMPORT_OPTION_KEY

ImporterNode = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.common_nodes.importer_node.ImporterNode',
    name='tfx.dsl.components.common.importer_node.ImporterNode',
    func_or_class=importer_node.ImporterNode)
예제 #18
0
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Experimental Resolver for getting the latest artifact."""

from tfx.dsl.input_resolution.strategies import latest_blessed_model_strategy
from tfx.utils import deprecation_utils

LatestBlessedModelResolver = deprecation_utils.deprecated_alias(
    'tfx.dsl.experimental.latest_blessed_model_resolver.LatestBlessedModelResolver',
    'tfx.dsl.input_resolution.strategies.latest_blessed_model_strategy.LatestBlessedModelStrategy',
    latest_blessed_model_strategy.LatestBlessedModelStrategy)
예제 #19
0
파일: base_driver.py 프로젝트: jay90099/tfx
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Stub for pre-rename `tfx.dsl.components.base.base_driver`."""

from tfx.dsl.components.base import base_driver
from tfx.utils import deprecation_utils

BaseDriver = deprecation_utils.deprecated_alias(  # pylint: disable=invalid-name
    deprecated_name='tfx.components.base.base_driver.BaseDriver',
    name='tfx.dsl.components.base.base_driver.BaseDriver',
    func_or_class=base_driver.BaseDriver)
예제 #20
0
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Experimental Resolver for getting the latest artifact."""

from tfx.dsl.input_resolution.strategies import latest_artifact_strategy
from tfx.utils import deprecation_utils

LatestArtifactsResolver = deprecation_utils.deprecated_alias(
    'tfx.dsl.experimental.latest_artifacts_resolver.LatestArtifactsResolver',
    'tfx.dsl.input_resolution.strategies.latest_artifact_strategy.LatestArtifactStrategy',
    latest_artifact_strategy.LatestArtifactStrategy)