id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
166,412
import json import os import re from typing import List from absl import logging from packaging import version from tfx.types import artifact as artifact_lib from ml_metadata.proto import metadata_store_pb2 The provided code snippet includes necessary dependencies for implementing the `encode_split_names` function. Wr...
Get the encoded representation of a list of split names.
166,413
import typing from typing import Callable, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Type, cast from tfx.dsl.placeholder import placeholder as ph from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.types import channel The provided code snippet includes necessary ...
Converts BaseChannel into a list of Channels.
166,414
import typing from typing import Callable, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Type, cast from tfx.dsl.placeholder import placeholder as ph from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.types import channel The provided code snippet includes necessary ...
Returns the union of channels. All channels should have the same artifact type, otherwise an error would be raised. Returned channel deduplicates the inputs so each artifact is guaranteed to be present at most once. `union()` does NOT guarantee any ordering of artifacts for the consumer component. Args: channels: An it...
166,415
import typing from typing import Callable, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Type, cast from tfx.dsl.placeholder import placeholder as ph from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.types import channel The provided code snippet includes necessary ...
Helper function to construct a query to get artifacts from an external pipeline. Args: artifact_type: Subclass of Artifact for this channel. owner: Owner of the pipeline. pipeline_name: Name of the pipeline the artifacts belong to. producer_component_id: Id of the component produces the artifacts. output_key: The outpu...
166,416
import typing from typing import Callable, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Type, cast from tfx.dsl.placeholder import placeholder as ph from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.types import channel The provided code snippet includes necessary ...
Unwraps a `x.future()[0].value` placeholder and returns its `x`. Args: placeholder: A placeholder expression. Returns: The (only) channel involved in the expression. Raises: ValueError: If the input placeholder is anything more complex than `some_channel.future()[0].value`, and in particular if it involves multiple cha...
166,417
import copy import inspect import itertools from typing import Any, Dict, List, Mapping, Optional, Type, cast from tfx.dsl.component.experimental.json_compat import check_strict_json_compat from tfx.dsl.placeholder import placeholder from tfx.types import artifact from tfx.types import channel from tfx.types.system_exe...
Replaces RuntimeParameter by its ptype's default. Args: data: an object possibly containing RuntimeParameter. Returns: A version of input data where RuntimeParameters are replaced with the default values of their ptype.
166,418
from __future__ import annotations import abc import copy import dataclasses import inspect import json import textwrap from typing import Any, Dict, Generic, Iterable, List, Optional, Sequence, Set, Type, TypeVar, Union, cast from absl import logging from tfx.dsl.placeholder import artifact_placeholder from tfx.types ...
null
166,419
from __future__ import annotations import abc import copy import dataclasses import inspect import json import textwrap from typing import Any, Dict, Generic, Iterable, List, Optional, Sequence, Set, Type, TypeVar, Union, cast from absl import logging from tfx.dsl.placeholder import artifact_placeholder from tfx.types ...
null
166,420
from __future__ import annotations import abc import copy import dataclasses import inspect import json import textwrap from typing import Any, Dict, Generic, Iterable, List, Optional, Sequence, Set, Type, TypeVar, Union, cast from absl import logging from tfx.dsl.placeholder import artifact_placeholder from tfx.types ...
Convenient method to combine multiple input channels into union channel.
166,421
import argparse import base64 import json from typing import List, Tuple import absl from absl import app from absl.flags import argparse_flags from tfx.dsl.components.base import base_beam_executor from tfx.dsl.components.base import base_executor from tfx.types import artifact_utils from tfx.utils import import_utils...
r"""Select a particular executor and run it based on name. # pylint: disable=line-too-long _run_executor() is used to invoke a class subclassing tfx.dsl.components.base.base_executor.BaseExecutor. This function can be used for both invoking the executor on remote environments as well as for unit testing of executors. H...
166,422
import argparse import base64 import json from typing import List, Tuple import absl from absl import app from absl.flags import argparse_flags from tfx.dsl.components.base import base_beam_executor from tfx.dsl.components.base import base_executor from tfx.types import artifact_utils from tfx.utils import import_utils...
Parses command line arguments. # pylint: disable=line-too-long Args: argv: Unparsed arguments for run_executor.py --executor_class_path: Python class of executor in format of <module>.<class>. --temp_directory_path: Common temp directory path for executors. --inputs: JSON serialized dict of input artifacts. If the inpu...
166,423
import os import sys from typing import List, Optional from tfx.dsl.components.base import base_beam_executor from tfx.dsl.components.base import base_executor from tfx.types import channel_utils from tfx.types.artifact import PropertyType from tfx.utils import import_utils from tfx.utils import proto_utils from google...
r"""Loads a component, instantiates it with arguments and runs its executor. The component class is instantiated, so the component code is executed, not just the executor code. To pass artifact URI, use <input_name>_uri argument name. To pass artifact property, use <input_name>_<property> argument name. Protobuf proper...
166,424
from typing import Dict, List, Optional from tfx import types from tfx.dsl.input_resolution import resolver_op from tfx.dsl.input_resolution.ops import ops_utils from tfx.dsl.input_resolution.ops import training_range_op from tfx.orchestration.portable.input_resolution import exceptions from tfx.utils import typing_uti...
Checks that the input_dict is properly formatted.
166,425
import collections from typing import List, Iterable, Tuple from tfx.dsl.input_resolution import resolver_op from tfx.orchestration.portable.input_resolution import exceptions from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The provided code snippet includes necessary dependencies f...
Gets artifact_id pair of neighbors from the list of Events. Artifact a and b is considered neighbor if there exist events e1 and e2 s.t. (e1.artifact_id = a) AND (e2.artifact_id = b) AND (e1.execution_id = e2.execution_id) Args: events: A list of MLMD Events. Yields: Edge as a tuple (artifact_id_1, artifact_id_2).
166,426
import collections from typing import List, Iterable, Tuple from tfx.dsl.input_resolution import resolver_op from tfx.orchestration.portable.input_resolution import exceptions from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The provided code snippet includes necessary dependencies f...
Finds disjoint sets.
166,427
from typing import Dict, Type, Union from tfx.dsl.components.common import resolver from tfx.dsl.input_resolution import resolver_op from tfx.dsl.input_resolution.ops import all_spans_op from tfx.dsl.input_resolution.ops import consecutive_spans_op from tfx.dsl.input_resolution.ops import equal_property_values_op from ...
null
166,428
import functools from typing import Dict, List, Optional, Sequence, Set from tfx import types from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import filter_query_builder as q from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The ...
Returns a filter query for valid artifact states.
166,429
import functools from typing import Dict, List, Optional, Sequence, Set from tfx import types from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import filter_query_builder as q from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The ...
Validates that the argument is >= a min value and/or <= a max value.
166,430
import functools from typing import Dict, List, Optional, Sequence, Set from tfx import types from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import filter_query_builder as q from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The ...
Returns artifacts that have the required property names and types.
166,431
import functools from typing import Dict, List, Optional, Sequence, Set from tfx import types from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import filter_query_builder as q from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The ...
Filters artifacts by their "span" PROPERTY. This should only be used a shared utility for LatestSpan and ConsecutiveSpans. Args: artifacts: The list of Artifacts to filter. span_descending: If true, then the artifacts will be sorted by span in descending order. Else, they will be sorted in ascending order by span. Set ...
166,432
import functools from typing import Dict, List, Optional, Sequence, Set from tfx import types from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import filter_query_builder as q from tfx.utils import typing_utils from ml_metadata.proto import metadata_store_pb2 The ...
Sorts the artifact dict values by (creation time, id).
166,433
from typing import Any, List, Sequence from tfx import types from tfx.dsl.input_resolution import resolver_op from tfx.dsl.input_resolution.ops import ops_utils from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import event_lib from tfx.types import artifact_utils f...
Checks that input_list contains only a single Model, and returns it.
166,434
from typing import Any, List, Sequence from tfx import types from tfx.dsl.input_resolution import resolver_op from tfx.dsl.input_resolution.ops import ops_utils from tfx.orchestration.portable.input_resolution import exceptions from tfx.orchestration.portable.mlmd import event_lib from tfx.types import artifact_utils f...
ContainsTrainingRange implementation, for shared use across ResolverOps. Returns the Examples artifact the Model was trained on. Note that only the standard TFleX Model and Examples artifacts are supported. Args: store: The MetadataStore. model: The Model artifact whose trained Examples to return. use_transformed_examp...
166,435
from __future__ import annotations import abc from typing import Any, Generic, Literal, Mapping, Optional, Sequence, Set, Type, TypeVar, Union import attr from tfx import types from tfx.proto.orchestration import pipeline_pb2 from tfx.utils import json_utils from tfx.utils import typing_utils import ml_metadata as mlmd...
Get `InputNode`s that are used to produce the given `output_node`.
166,436
from typing import Dict, List, Optional, Any from tfx import types from tfx.dsl.components.common import resolver from tfx.utils import doc_controls import ml_metadata as mlmd def _get_span_custom_property(artifact: types.Artifact) -> int: # For backward compatibility, span may be stored as a string. str_span = ar...
null
166,437
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns the n latest createst artifacts, ties broken by artifact id. Args: artifacts: The artifacts to filter. n: The number of latest artifacts to return, must be > 0. Returns: The n latest artifacts.
166,438
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns the n latest version artifacts, ties broken by artifact id. Args: artifacts: The artifacts to filter. n: The number of latest artifacts to return, must be > 0. Returns: The n latest artifacts.
166,439
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns artifacts with spans in [start_span, end_span] inclusive. This resolver function is based on the span-version semantics, which only considers the latest version of each span. If you want to keep all versions, then set keep_all_versions=True. Input artifacts must have both "span" int property and "version" int p...
166,440
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns artifacts with spans in a rolling range. A rolling range covers the latest (largest) spans. It's calculated in the following order: 1. Sort the artifacts by span in ascending order. 2. Remove the last skip_num_recent_spans number of spans (removing the largest spans). 3. Select the last num_spans number of span...
166,441
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns the sorted artifacts with unique spans. By default, all artifacts with unique spans (ties broken by latest version) are returned. Example usage: Consider 6 artifacts with: spans = [1, 3, 3, 2, 8, 7] versions = [0, 0, 1, 0, 1, 2] all_spans() will return artifacts: spans = [1, 2, 3, 7, 8] versions = [0, 0, 1, 2, ...
166,442
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Shuffles the artifacts (in a uniform random way) by span. Example usage: Consider 4 artifacts with: spans = [1, 2, 3, 4] shuffle() will return artifacts randomly shuffled, e.g.: spans = [3, 4, 2, 1] Args: artifacts: The artifacts to filter. Returns: The randomly shuffled artifacts.
166,443
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns the artifacts in the latest COMPLETE pipeline run. Example usage: producer_pipeline = Pipeline(outputs={ 'examples': example_gen.outputs['examples'], 'schema': schema_gen.outputs['schema'] }) consumer_pipeline_inputs = PipelineInputs( latest_pipeline_run_outputs(producer_pipeline), output_keys=['examples', 'sch...
166,444
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Output type inferrer of resolver function latest_pipeline_run_outputs. Args: pipeline: The pipeline producing the artifacts. output_keys: (Optional) A list of output keys. If provided, only the artifacts of the key in this list will return by this function, otherwise, all available output keys of the producer pipeline ...
166,445
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns artifacts with spans in a sequential rolling range. Sequential rolling range is a sliding window on the oldest consecutive spans. The consecutive spans must be in the range: [start_span_number, max_span - skip_num_recent_spans], where max_span is the maximum span present in the artifacts. This range is modified...
166,446
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types def _infer_seqential_rolling_range_type(channel, **kwargs): # pylint: ...
null
166,447
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Pairs up Examples from different channels, matching by (span, version). This enables grouping together Artifacts from separate channels. Example usage: NOTE: Notation here is `{artifact_type}:{span}:{version}` >>> paired_spans({'x': channel([X:0:0, X:0:1, X:1:0, X:2:0]), 'y': channel([Y:0:0, Y:0:1, Y:1:0, Y:3:0])}) Loo...
166,448
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns artifacts with matching property values. Example usage: Consider artifacts [A, B, C] with bool property 'blessed' set to [True, True, False]. filter_property_equal( [A, B, C], property_key='blessed', property_value=False, ) will return [C]. Args: artifacts: The list of artifacts to filter. key: The property key...
166,449
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns artifacts with matching custom property values. Example usage: Consider artifact [A, B, C] with int custom property 'purity' set to [1, 1, 2]. filter_custom_property_equal( [A, B, C], property_key='purity', property_value=2, ) will return [C]. Args: artifacts: The list of artifacts to filter. key: The property ...
166,450
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types def _slice(artifacts, **kwargs): # It's important to not pass the None...
Pick an i'th artifact from channel. Like in python, negative indexing is allowed. If the index is out of range, in synchronous pipeline it raises an error and the component would not get executed. In asynchronous pipeline, it will wait until the input length is sufficient to handle the index. Usage: ```python # In ASYN...
166,451
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types def _slice(artifacts, **kwargs): # It's important to not pass the None...
Pick slice(start, stop) of the input artifacts. Like in python, negative indexing is allowed. If the range is larger than the number of artifacts in the channel, then like in python slice, the result would be truncated to the available values. You can use min_count to ensure the range has enough values. In synchronous ...
166,452
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types The provided code snippet includes necessary dependencies for implement...
Returns artifacts with a sliding window applied. For example, for a channel with artifacts [A, B, C, D] and window_size = 2, [[A, B], [B, C], [C, D]] will be returned. For Examples artifacts, sequential_rolling_range() should be used instead. Because sliding_window() returns multiple windows, it must be used together w...
166,453
from typing import Optional, Sequence, Union from absl import logging from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import artifact from tfx.types import channel as channel_types def _infer_sliding_window_type(channel: channel_types.BaseChannel, **kw...
null
166,454
import contextlib import inspect from typing import Callable, Type, Union, Mapping, Any, Optional, Sequence, cast, overload from tfx.dsl.control_flow import for_each_internal from tfx.dsl.input_resolution import resolver_op from tfx.types import artifact from tfx.types import channel from tfx.types import resolved_chan...
Default _TypeInferrer that mirrors args[0] type.
166,455
import contextlib import inspect from typing import Callable, Type, Union, Mapping, Any, Optional, Sequence, cast, overload from tfx.dsl.control_flow import for_each_internal from tfx.dsl.input_resolution import resolver_op from tfx.types import artifact from tfx.types import channel from tfx.types import resolved_chan...
null
166,456
import contextlib import inspect from typing import Callable, Type, Union, Mapping, Any, Optional, Sequence, cast, overload from tfx.dsl.control_flow import for_each_internal from tfx.dsl.input_resolution import resolver_op from tfx.types import artifact from tfx.types import channel from tfx.types import resolved_chan...
null
166,457
import contextlib import inspect from typing import Callable, Type, Union, Mapping, Any, Optional, Sequence, cast, overload from tfx.dsl.control_flow import for_each_internal from tfx.dsl.input_resolution import resolver_op from tfx.types import artifact from tfx.types import channel from tfx.types import resolved_chan...
Decorator for the resolver function. Args: f: Python function to decorate. See the usage at canned_resolver_function.py output_type: Optional static output type hint. unwrap_dict_key: If present, it will add loopable transform that unwraps dictionary key(s) so that `ForEach` captured value is a single channel, or a tup...
166,458
import inspect from typing import Any, Dict, Generic, List, Type, TypeVar, Union, get_args, get_origin from tfx.dsl.component.experimental import json_compat from tfx.types import artifact from tfx.utils import deprecation_utils The provided code snippet includes necessary dependencies for implementing the `_check_val...
Check if the annotation params is an Artifact or a List[Artifact].
166,459
import copy import functools import types import typing from typing import Any, Callable, ClassVar, Dict, List, Optional, Protocol, Type, Union from tfx import types as tfx_types from tfx.dsl.component.experimental import function_parser from tfx.dsl.component.experimental import json_compat from tfx.dsl.component.expe...
Extracts function arguments for the decorated function.
166,460
import copy import functools import types import typing from typing import Any, Callable, ClassVar, Dict, List, Optional, Protocol, Type, Union from tfx import types as tfx_types from tfx.dsl.component.experimental import function_parser from tfx.dsl.component.experimental import json_compat from tfx.dsl.component.expe...
Validates and assigns the outputs to the output_dict.
166,461
from typing import Union, cast, Any from tfx.dsl.context_managers import dsl_context_manager from tfx.dsl.control_flow import for_each_internal from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import channel as channel_types def _for_each_impl(channel: ...
null
166,462
from typing import Union, cast, Any from tfx.dsl.context_managers import dsl_context_manager from tfx.dsl.control_flow import for_each_internal from tfx.dsl.input_resolution import resolver_function from tfx.dsl.input_resolution.ops import ops from tfx.types import channel as channel_types def _for_each_output_type(ch...
null
166,463
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
null
166,464
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Performs pre-compile validations.
166,465
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Compiles the node contexts of a pipeline node.
166,466
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Compiles the outputs of a pipeline node.
166,467
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Generates InputSpec for pipeline outputs to be consumed later.
166,468
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Compiles exec properties of a pipeline node.
166,469
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Compiles and sets NodeExecutionOptions of a pipeline node.
166,470
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Finds all upstream nodes that the current node depends on.
166,471
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Finds all downstream nodes that depend on the current node.
166,472
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Checks if a node needs to declare the begin node as its upstream node.
166,473
import itertools from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.compiler import node_execution_options_utils from tfx.d...
Checks if a node needs to declare the eng node as its downstream node.
166,474
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Resolves execution mode for a tfx pipeline. Args: tfx_pipeline: a TFX pipeline python object assembled by SDK. Returns: a proto enum reflecting the execution mode of the pipeline. Raises: RuntimeError: when execution mode is ASYNC while `enable_cache` is true. ValueError: when seeing unrecognized execution mode.
166,475
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Helper function to check if a TFX node is an Importer.
166,476
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Builds the type name of a Pipeline Begin node.
166,477
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Builds the type name of a Pipeline End node.
166,478
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Builds the node id of a Pipeline Begin node.
166,479
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Builds the node id of a Pipeline End node.
166,480
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Builds the end_node context name of a composable pipeline.
166,481
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Builds a function that returns the key of a channel for consumer node.
166,482
from typing import cast, List, Optional, Sequence, Tuple, Type, Union, Dict, Any, Set from tfx import types from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_node from tfx.dsl.components.common import importer from tfx.dsl.components.common import resolver from tfx.dsl.context_managers imp...
Create a dummy pipeline end node. pipeline end node does not appear in pipeline DSL but only in the pipeline IR. To generalizes compilation process for the pipeline end node, create a dummy BaseNode whose inputs are set as pipeline.outputs. Args: p: A Pipeline instance whose pipeline end node will be created. Returns: ...
166,483
from typing import Type, cast from tfx import types from tfx.dsl.compiler import compiler_context from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.dsl.components.base import base_component from tfx.dsl.components.base import base_node from tfx.dsl.experimental.conditionals imp...
Compile NodeInputs from BaseNode input channels.
166,484
import base64 import enum import functools import os import re from typing import Any, Callable, Union, cast from absl import logging import attr from tfx.dsl.io import fileio from tfx.orchestration.portable import data_types from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.ty...
Ensures that expression resolves to boolean. NOTE: This is currently used to ensure that the inputs to logical operators are boolean. Since the DSL for creating Predicate expressions do not currently perform implicit boolean conversions, the evaluator should not support it either. If we support implicit boolean convers...
166,485
import base64 import enum import functools import os import re from typing import Any, Callable, Union, cast from absl import logging import attr from tfx.dsl.io import fileio from tfx.orchestration.portable import data_types from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.ty...
Decorator function for registering operators. Internal in this module.
166,486
import base64 import enum import functools import os import re from typing import Any, Callable, Union, cast from absl import logging import attr from tfx.dsl.io import fileio from tfx.orchestration.portable import data_types from tfx.proto.orchestration import placeholder_pb2 from tfx.types import artifact from tfx.ty...
Returns all Placeholder.Type contained in a PlaceholderExpression.
166,487
import abc from collections.abc import Mapping, Sequence from typing import Callable, Optional, Union import attr from tfx.orchestration import data_types_utils from tfx.proto.orchestration import execution_hook_pb2 from ml_metadata.proto import metadata_store_pb2 _PrimitiveFlagValueType = Union[int, float, str, bool] ...
null
166,488
import abc from collections.abc import Mapping, Sequence from typing import Callable, Optional, Union import attr from tfx.orchestration import data_types_utils from tfx.proto.orchestration import execution_hook_pb2 from ml_metadata.proto import metadata_store_pb2 _PrimitiveFlagValueType = Union[int, float, str, bool] ...
null
166,489
from __future__ import annotations from typing import Dict, Generic, Iterator, Mapping, Optional, TypeVar, Union from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import any_pb2 from google.protobuf import descript...
Returns a placeholder that resolves to a proto with the given fields. Basic usage: ```python flags=[ ( 'my_proto_flag', ph.make_proto( MyProtoType(), field1='a plain value', field2=ph.execution_invocation().pipeline_run_id, field3=ph.make_proto( MySubProtoType(inner_field1='fixed value'), inner_field2=ph.input('foo').u...
166,490
from __future__ import annotations import typing from typing import Any, Literal, Union from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 from google.protobuf import message class ExecPropertyPlaceholder(placeholder_base.Placeholder): """ExecProperty Placeholder repr...
Returns a Placeholder that represents an execution property. Args: key: The key of the output artifact. Returns: A Placeholder that supports 1. Rendering the value of an execution property at a given key. Example: exec_property('version') 2. Rendering the whole proto or a proto field of an execution property, if the va...
166,491
from __future__ import annotations import typing from typing import Any, Literal, Union from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 from google.protobuf import message RuntimeInfoKeys = Literal[ 'executor_spec', 'platform_config', 'pipeline_platform_c...
Returns a Placeholder that contains runtime information for component. Currently the runtime info includes following keys: 1. executor_spec: The executor spec proto. 2. platform_config: A proto that contains platform-specific information for the current pipeline node. 3. pipeline_platform_config: A proto that contains ...
166,492
from __future__ import annotations import typing from typing import Any, Literal, Union from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 from google.protobuf import message class ExecInvocationPlaceholder(placeholder_base.Placeholder): """Execution Invocation Placeh...
Returns a Placeholder representing ExecutionInvocation proto. Returns: A Placeholder that will render to the ExecutionInvocation proto. Accessing a proto field is the same as if accessing a proto field in Python. Prefer to use input(key)/output(key)/exec_property(key) functions instead of input_dict/output_dict/executi...
166,493
from __future__ import annotations import typing from typing import Any, Literal, Union from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 from google.protobuf import message class EnvironmentVariablePlaceholder(placeholder_base.Placeholder): """Environment Variable P...
Returns a Placeholder representing EnvironmentVariable proto. Args: key: The key of the environment variable. Returns: A Placeholder that supports 1. Rendering the value of an environment variable for a given key. Example: environment_variable('FOO') 2. Concatenating with other placeholders or strings. Example: 'foo=' ...
166,494
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message class Predicate...
Applies a NOT boolean operation on a Predicate. Args: pred: The Predicate to apply the NOT operation to. Returns: The negated Predicate.
166,495
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message class Predicate...
Applies the AND boolean operation on two Predicates. Args: left: The first argument of the AND operation. right: The second argument of the AND operation. Returns: The Predicate resulting from the AND operation.
166,496
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message class Predicate...
Applies the OR boolean operation on two Predicates. Args: left: The first argument of the OR operation. right: The second argument of the OR operation. Returns: The Predicate resulting from the OR operation.
166,497
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message ValueLikeType =...
Returns a ListPlaceholder representing a list of input placeholders.
166,498
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message class Placehold...
Joins a list consisting of placeholders and strings using separator. Returns an empty string if placeholders is empty. Args: placeholders: List of placeholders and/or strings. separator: The separator to use when joining the passed in values. Returns: A Placeholder representing the concatenation of all elements passed ...
166,499
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message class Placehold...
Runs os.path.join() on placeholder arguments. Args: *args: (Placeholders that resolve to) strings which will be passed to os.path.join(). Returns: A placeholder that will resolve to the joined path.
166,500
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message ValueLikeType =...
Returns a DictPlaceholder representing a dict of input placeholders. Args: entries: A mapping that will become the final dict after running placeholder resolution on each of the values. Values that resolve to None are dropped. If you also want placeholders in the keys, you need to pass the dict as a sequence of (k,v) t...
166,501
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message The provided c...
Like issubclass(), but supports Union types on the sub-class side. Args: test_type: A sub-type to test. Can be a Union or a plain class. parent_type: A parent type (class, type or tuple of classes/types). Returns: True if the test_type is a sub-type of the parent_type. If the test_type is a Union, any of them is allowe...
166,502
from __future__ import annotations import abc import enum import functools import types import typing from typing import Any, Iterator, Mapping, Optional, Sequence, Union import attr from tfx.proto.orchestration import placeholder_pb2 from tfx.utils import proto_utils from google.protobuf import message ValueLikeType =...
Encodes x to a placeholder expression proto.
166,503
from __future__ import annotations from typing import Any, Optional from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 class ArtifactPlaceholder(placeholder_base.Placeholder): """Artifact Placeholder represents an input or an output artifact. Prefer to use ph.input(...
Returns a Placeholder that represents an input artifact. Args: key: The key of the input artifact. Returns: A Placeholder that supports 1. Rendering the whole MLMD artifact proto as text_format. Example: input('model') 2. Accessing a specific index using [index], if multiple artifacts are associated with the given key....
166,504
from __future__ import annotations from typing import Any, Optional from tfx.dsl.placeholder import placeholder_base from tfx.proto.orchestration import placeholder_pb2 class ArtifactPlaceholder(placeholder_base.Placeholder): """Artifact Placeholder represents an input or an output artifact. Prefer to use ph.input(...
Returns a Placeholder that represents an output artifact. It is the same as input(...) function, except it is for output artifacts. Args: key: The key of the output artifact. Returns: A Placeholder that supports 1. Rendering the whole artifact as text_format. Example: output('model') 2. Accessing a specific index using...
166,505
import abc import copy from typing import Any, Dict, Optional, Type from tfx.dsl.components.base import base_driver from tfx.dsl.components.base import base_executor from tfx.dsl.components.base import executor_spec as executor_spec_module from tfx.dsl.context_managers import dsl_context_registry from tfx.dsl.experimen...
Returns an abstract property for use in an ABC abstract class.
166,506
import os from typing import Any, Dict, List import absl from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration import metadata from tfx.types import artifact_utils from tfx.types import channel_utils The provided code snippet includes necessary dependencies...
Generate uri for output artifact.
166,507
import os from typing import Any, Dict, List import absl from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration import metadata from tfx.types import artifact_utils from tfx.types import channel_utils The provided code snippet includes necessary dependencies...
Create output directories for output artifact.
166,508
from typing import Any, Dict, List, Optional, Type, Union import absl from tfx import types from tfx.dsl.components.base import base_driver from tfx.dsl.components.base import base_node from tfx.orchestration import data_types from tfx.orchestration import metadata from tfx.types import channel_utils from tfx.utils imp...
Generates Importer's output dict. If there is already an artifact in MLMD with the same URI and properties / custom properties, that artifact will be reused unless the `reimport` argument is set to True. Args: metadata_handle: The handler of MLMD. uri: The uri of the artifact. properties: The properties of the artifact...
166,509
from typing import Any, Callable, Iterable, List, Optional, Tuple, Type from tfx.dsl.io import filesystem from tfx.dsl.io import filesystem_registry from tfx.dsl.io.filesystem import PathType import tfx.dsl.io.plugins.tensorflow_gfile import tfx.dsl.io.plugins.local def _get_filesystem(path) -> Type[filesystem.Filesy...
Make a directory at the given path; parent directory must exist.
166,510
from typing import Any, Callable, Iterable, List, Optional, Tuple, Type from tfx.dsl.io import filesystem from tfx.dsl.io import filesystem_registry from tfx.dsl.io.filesystem import PathType import tfx.dsl.io.plugins.tensorflow_gfile import tfx.dsl.io.plugins.local def _get_filesystem(path) -> Type[filesystem.Filesy...
Return a path for an inline file with the given content.
166,511
import collections from collections.abc import Iterable, Iterator import contextlib import threading from typing import Any, Optional from tfx.dsl.context_managers import dsl_context class DslContextRegistry: """Registry for DslContexts and associated BaseNodes of a pipeline DSL. DslContextRegistry manages the acti...
Push the new registry to the global scope.