From c8fcf22a024d38d04bd87cbb1d7849d98442b180 Mon Sep 17 00:00:00 2001 From: rtg0795 <36429068+rtg0795@users.noreply.github.com> Date: Mon, 4 Apr 2022 01:10:45 -0400 Subject: [PATCH] Update 1.7.1 in version.py (#4790) --- README.md | 1 + RELEASE.md | 71 ++----------------- .../portable/input_resolution/processor.py | 27 ++++++- .../input_resolution/processor_test.py | 20 ++++++ tfx/version.py | 2 +- 5 files changed, 50 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index cf6e274b0e..d1c488718b 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ but other *untested* combinations may also work. tfx | apache-beam[gcp] | ml-metadata | pyarrow | tensorflow | tensorflow-data-validation | tensorflow-metadata | tensorflow-model-analysis | tensorflow-serving-api | tensorflow-transform | tfx-bsl ------------------------------------------------------------------------- | ---------------- | ----------- | ------- | ----------------- | -------------------------- | ------------------- | ------------------------- | ---------------------- | -------------------- | ------- [GitHub master](https://github.com/tensorflow/tfx/blob/master/RELEASE.md) | 2.36.0 | 1.7.0 | 5.0.0 | nightly (1.x/2.x) | 1.7.0 | 1.7.0 | 0.38.0 | 2.8.0 | 1.7.0 | 1.7.0 +[1.7.1](https://github.com/tensorflow/tfx/blob/v1.7.1/RELEASE.md) | 2.36.0 | 1.7.0 | 5.0.0 | 1.15.5 / 2.8.0 | 1.7.0 | 1.7.0 | 0.38.0 | 2.8.0 | 1.7.0 | 1.7.0 [1.7.0](https://github.com/tensorflow/tfx/blob/v1.7.0/RELEASE.md) | 2.36.0 | 1.7.0 | 5.0.0 | 1.15.5 / 2.8.0 | 1.7.0 | 1.7.0 | 0.38.0 | 2.8.0 | 1.7.0 | 1.7.0 [1.6.0](https://github.com/tensorflow/tfx/blob/v1.6.0/RELEASE.md) | 2.35.0 | 1.6.0 | 5.0.0 | 1.15.5 / 2.7.0 | 1.6.0 | 1.6.0 | 0.37.0 | 2.7.0 | 1.6.0 | 1.6.0 [1.5.0](https://github.com/tensorflow/tfx/blob/v1.5.0/RELEASE.md) | 2.34.0 | 1.5.0 | 5.0.0 | 1.15.2 / 2.7.0 | 1.5.0 | 1.5.0 | 0.36.0 | 2.7.0 | 1.5.0 | 1.5.0 diff --git a/RELEASE.md b/RELEASE.md index 85fc5aee9a..06c0e25c71 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,83 +1,20 @@ -# Version 1.7.0 +# Version 1.7.1 ## Major Features and Improvements -* Added support for list-type Placeholder. - ## Breaking Changes ### For Pipeline Authors -* N/A - ### For Component Authors -* N/A - ## Deprecations -* Removed the already-deprecated components.ImporterNode, should use - v1.dsl.Importer instead. -* Deprecated Channel property setters. Use constructor argument instead. - ## Bug Fixes and Other Changes -* Fixed the cluster spec error in CAIP Tuner on Vertex when - `num_parallel_trials = 1` -* Replaced deprecated assertDictContainsSubset with - assertLessEqual(itemsA, itemsB). -* Updating Keras tutorial to make better use of Keras, and better feature - engineering. -* Merges KFP UI Metadata file if it already exists. Now components can produce - their own UI results and it will be merged with existing visualization. -* Switch Transform component to always use sketch when computing top-k stats. +* Fix that the resolver with custom `ResolverStrategy` (assume correctly + packaged) fails. ## Dependency Updates -| Package Name | Version Constraints | Previously (in `v1.6.0`) | Comments | -| -- | -- | -- | -- | -| `apache-beam[gcp]` | `~=2.36` | `~=2.35` | Synced release train | -| `google-cloud-aiplatform` | `>=1.6.2,<2` | `>=1.5.0,<2` | | -| `ml-metadata` | `~=1.7.0` | `~=1.6.0` | Synced release train | -| `struct2tensor` | `~=0.38.0` | `~=0.37.0` | Synced release train | -| `tensorflow` | `>=1.15.5,<2` or `~=2.8.0` | `>=1.15.5,<2` or `~=2.7.0` | | -| `tensorflow-data-validation` | `~=1.7.0` | `~=1.6.0` | Synced release train | -| `tensorflow-decision-forests` | `==0.2.4` | `==0.2.1` | | -| `tensorflow-model-analysis` | `~=0.38.0` | `~=0.37.0` | Synced release train | -| `tensorflow-serving-api` | `>=1.15,<3` or `~=2.8.0` | `>=1.15,<3` or `~=2.7.0` | | -| `tensorflow-transform` | `~=1.7.0` | `~=1.6.0` | Synced release train | -| `tfx-bsl` | `~=1.7.0` | `~=1.6.0` | Synced release train | - -## Documentation Updates - -* N/A - -# Version 1.6.1 - -## Major Features and Improvements - -* N/A - -## Breaking Changes - -### For Pipeline Authors - -* N/A - -### For Component Authors - -* N/A - -## Deprecations - -* N/A - -## Bug Fixes and Other Changes - -* Fixed `Pusher` issue that didn't copy files other than - `saved_model.pb`. - -## Documentation Updates - -* N/A - +## Documentation Updates \ No newline at end of file diff --git a/tfx/orchestration/portable/input_resolution/processor.py b/tfx/orchestration/portable/input_resolution/processor.py index 9c287637b5..2c08424c90 100644 --- a/tfx/orchestration/portable/input_resolution/processor.py +++ b/tfx/orchestration/portable/input_resolution/processor.py @@ -13,7 +13,8 @@ # limitations under the License. """In process inplementation of Resolvers.""" -from typing import Iterable, Union, Sequence, cast +import inspect +from typing import Iterable, Union, Sequence, cast, Type from tfx.dsl.components.common import resolver from tfx.dsl.input_resolution import resolver_op @@ -21,11 +22,16 @@ from tfx.orchestration.portable.input_resolution import exceptions from tfx.proto.orchestration import pipeline_pb2 from tfx.utils import json_utils +from tfx.utils import name_utils from tfx.utils import typing_utils import ml_metadata as mlmd +_ResolverOpClass = Union[ + Type[resolver_op.ResolverOp], + Type[resolver.ResolverStrategy], +] # Types that can be used as an argument & return value of an resolver op. _ResolverIOType = Union[ typing_utils.ArtifactMultiMap, @@ -33,6 +39,21 @@ ] +def _resolve_class_path(class_path: str) -> _ResolverOpClass: + """Resolves ResolverOp or ResolverStrategy class from class path.""" + try: + return ops.get_by_class_path(class_path) + except KeyError: + pass + # Op not registered (custom ResolverOp or custom ResolverStrategy). It is + # user's responsibility to package the custom op definition code together. + result = name_utils.resolve_full_name(class_path) + if not inspect.isclass(result): + raise TypeError( + f'Invalid symbol {class_path}. Expected class type but got {result}.') + return result + + def _run_resolver_strategy( input_dict: typing_utils.ArtifactMultiMap, *, @@ -84,13 +105,13 @@ def run_resolver_steps( result = input_dict context = resolver_op.Context(store=store) for step in resolver_steps: - cls = ops.get_by_class_path(step.class_path) + cls = _resolve_class_path(step.class_path) if step.config_json: kwargs = json_utils.loads(step.config_json) else: kwargs = {} if issubclass(cls, resolver.ResolverStrategy): - strategy = cls(**kwargs) + strategy = cls(**kwargs) # pytype: disable=not-instantiable result = _run_resolver_strategy( cast(typing_utils.ArtifactMultiMap, result), strategy=strategy, diff --git a/tfx/orchestration/portable/input_resolution/processor_test.py b/tfx/orchestration/portable/input_resolution/processor_test.py index edda7a21a8..3abb4f5aa4 100644 --- a/tfx/orchestration/portable/input_resolution/processor_test.py +++ b/tfx/orchestration/portable/input_resolution/processor_test.py @@ -47,6 +47,12 @@ def resolve_artifacts(self, store, input_dict): return None +class UnregisteredStrategy(resolver.ResolverStrategy): + + def resolve_artifacts(self, store, input_dict): + return input_dict + + @ops.register class RepeatOp(resolver_op.ResolverOp): num = resolver_op.ResolverOpProperty(type=int) @@ -212,6 +218,20 @@ def testRunResolverSteps_MixedResolverOpAndStrategy(self): self.assertLen(result['examples'], 4) self.assertLen(result['model'], 4) + def testRunResolverSteps_UnregisteredResolverStrategy(self): + config = pipeline_pb2.ResolverConfig() + text_format.Parse(r""" + resolver_steps { + class_path: "__main__.UnregisteredStrategy" + } + """, config) + result = processor.run_resolver_steps( + self._input_dict, + resolver_steps=config.resolver_steps, + store=self._store) + + self.assertEqual(result, self._input_dict) + if __name__ == '__main__': tf.test.main() diff --git a/tfx/version.py b/tfx/version.py index e065f1e399..aa04f4412c 100644 --- a/tfx/version.py +++ b/tfx/version.py @@ -14,4 +14,4 @@ """Contains the version string of TFX.""" # Note that setup.py uses this version. -__version__ = '1.7.0' +__version__ = '1.7.1' \ No newline at end of file