![]() |
Class for dealing with pipeline state. Can be used as a context manager.
tfx.orchestration.experimental.core.pipeline_state.PipelineState(
mlmd_handle: tfx.orchestration.metadata.Metadata
,
pipeline_uid: tfx.orchestration.experimental.core.task.PipelineUid
,
context: metadata_store_pb2.Context,
execution: metadata_store_pb2.Execution,
commit: bool = False
)
Attributes | |
---|---|
pipeline
|
Methods
commit
commit() -> None
Commits pipeline state to MLMD if there are any mutations.
initiate_node_start
initiate_node_start(
node_uid: tfx.orchestration.experimental.core.task.NodeUid
) -> None
Updates pipeline state to signal that a node should be started.
initiate_node_stop
initiate_node_stop(
node_uid: tfx.orchestration.experimental.core.task.NodeUid
) -> None
Updates pipeline state to signal that a node should be stopped.
initiate_stop
initiate_stop() -> None
Updates pipeline state to signal stopping pipeline execution.
is_node_stop_initiated
is_node_stop_initiated(
node_uid: tfx.orchestration.experimental.core.task.NodeUid
) -> bool
Returns True
if stopping has been initiated for the given node.
is_stop_initiated
is_stop_initiated() -> bool
Returns True
if pipeline execution stopping has been initiated.
load
@classmethod
load( mlmd_handle:
tfx.orchestration.metadata.Metadata
, pipeline_uid:tfx.orchestration.experimental.core.task.PipelineUid
) -> "PipelineState"
Loads pipeline state from MLMD.
Args | |
---|---|
mlmd_handle
|
A handle to the MLMD db. |
pipeline_uid
|
Uid of the pipeline state to load. |
Returns | |
---|---|
A PipelineState object.
|
Raises | |
---|---|
status_lib.StatusNotOkError
|
With code=NOT_FOUND if no active pipeline with the given pipeline uid exists in MLMD. With code=INTERNAL if more than 1 active execution exists for given pipeline uid. |
load_from_orchestrator_context
@classmethod
load_from_orchestrator_context( mlmd_handle:
tfx.orchestration.metadata.Metadata
, context: metadata_store_pb2.Context ) -> "PipelineState"
Loads pipeline state for active pipeline under given orchestrator context.
Args | |
---|---|
mlmd_handle
|
A handle to the MLMD db. |
context
|
Pipeline context under which to find the pipeline execution. |
Returns | |
---|---|
A PipelineState object.
|
Raises | |
---|---|
status_lib.StatusNotOkError
|
With code=NOT_FOUND if no active pipeline exists for the given context in MLMD. With code=INTERNAL if more than 1 active execution exists for given pipeline uid. |
new
@classmethod
new( mlmd_handle:
tfx.orchestration.metadata.Metadata
, pipeline: pipeline_pb2.Pipeline ) -> "PipelineState"
Creates a PipelineState
object for a new pipeline.
No active pipeline with the same pipeline uid should exist for the call to be successful.
Args | |
---|---|
mlmd_handle
|
A handle to the MLMD db. |
pipeline
|
IR of the pipeline. |
Returns | |
---|---|
A PipelineState object.
|
Raises | |
---|---|
status_lib.StatusNotOkError
|
If a pipeline with same UID already exists. |
remove_property
remove_property(
property_key: Text
) -> None
Removes a custom property of the pipeline execution if exists.
save_property
save_property(
property_key: Text,
property_value: Text
) -> None
Saves a custom property to the pipeline execution.
__enter__
__enter__() -> "PipelineState"
__exit__
__exit__(
exc_type, exc_val, exc_tb
)