Skip to content

Commit

Permalink
no-op
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 625128214
  • Loading branch information
tfx-copybara committed Apr 16, 2024
1 parent 9332479 commit b3f5971
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
30 changes: 30 additions & 0 deletions tfx/orchestration/datahub_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2024 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.
"""Utils to log Tflex/MLMD entities to Datahub."""
from typing import Optional

from tfx.orchestration.experimental.core import task as task_lib
from tfx.utils import typing_utils

from ml_metadata.proto import metadata_store_pb2


def log_component_execution(
execution: metadata_store_pb2.Execution,
task: task_lib.ExecNodeTask,
output_artifacts: Optional[typing_utils.ArtifactMultiMap] = None,
):
"""Logs a Tflex component execution and its input/output artifacts."""
del execution, task, output_artifacts
return None
11 changes: 10 additions & 1 deletion tfx/orchestration/portable/execution_publish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Portable library for registering and publishing executions."""

from typing import Mapping, Optional, Sequence
import uuid

from tfx import types
from tfx.orchestration import data_types_utils
from tfx.orchestration import metadata
from tfx.orchestration.experimental.core import task as task_lib
from tfx.orchestration import datahub_utils
from tfx.orchestration.portable import merge_utils
from tfx.orchestration.portable.mlmd import execution_lib
from tfx.proto.orchestration import execution_result_pb2
Expand Down Expand Up @@ -75,6 +78,7 @@ def publish_succeeded_execution(
contexts: Sequence[metadata_store_pb2.Context],
output_artifacts: Optional[typing_utils.ArtifactMultiMap] = None,
executor_output: Optional[execution_result_pb2.ExecutorOutput] = None,
task: Optional[task_lib.ExecNodeTask] = None,
) -> tuple[
Optional[typing_utils.ArtifactMultiMap],
metadata_store_pb2.Execution,
Expand All @@ -95,11 +99,12 @@ def publish_succeeded_execution(
event with type OUTPUT.
executor_output: Executor outputs. `executor_output.output_artifacts` will
be used to update system-generated output artifacts passed in through
`output_artifacts` arg. There are three contraints to the update: 1. The
`output_artifacts` arg. There are three constraints to the update: 1. The
keys in `executor_output.output_artifacts` are expected to be a subset of
the system-generated output artifacts dict. 2. An update to a certain key
should contains all the artifacts under that key. 3. An update to an
artifact should not change the type of the artifact.
task: the task that just completed its component execution.
Returns:
The tuple containing the maybe updated output_artifacts (note that only
Expand Down Expand Up @@ -155,6 +160,10 @@ def publish_succeeded_execution(
output_artifacts=output_artifacts_to_publish,
)

datahub_utils.log_component_execution(
execution, task, output_artifacts_to_publish
)

return output_artifacts_to_publish, execution


Expand Down

0 comments on commit b3f5971

Please sign in to comment.