30
30
from tfx .orchestration import metadata
31
31
from tfx .orchestration import node_proto_view
32
32
from tfx .orchestration .experimental .core import constants
33
+ from tfx .orchestration .experimental .core import env
33
34
from tfx .orchestration .experimental .core import mlmd_state
34
35
from tfx .orchestration .experimental .core import task as task_lib
35
36
from tfx .orchestration import mlmd_connection_manager as mlmd_cm
@@ -548,21 +549,35 @@ def register_executions_from_existing_executions(
548
549
contexts = metadata_handle .store .get_contexts_by_execution (
549
550
existing_executions [0 ].id
550
551
)
551
- return execution_lib .put_executions (
552
+ executions = execution_lib .put_executions (
552
553
metadata_handle ,
553
554
new_executions ,
554
555
contexts ,
555
556
input_artifacts_maps = input_artifacts ,
556
557
)
557
558
559
+ pipeline_asset = metadata_handle .store .pipeline_asset
560
+ if pipeline_asset :
561
+ env .get_env ().create_pipeline_run_node_executions (
562
+ pipeline_asset .owner ,
563
+ pipeline_asset .name ,
564
+ pipeline ,
565
+ node .node_info .id ,
566
+ executions ,
567
+ )
568
+
569
+ return executions
570
+
558
571
559
572
def register_executions (
560
573
metadata_handle : metadata .Metadata ,
561
574
execution_type : metadata_store_pb2 .ExecutionType ,
562
575
contexts : Sequence [metadata_store_pb2 .Context ],
563
576
input_and_params : Sequence [InputAndParam ],
577
+ pipeline : Optional [pipeline_pb2 .Pipeline ] = None ,
578
+ node_id : Optional [str ] = None ,
564
579
) -> Sequence [metadata_store_pb2 .Execution ]:
565
- """Registers multiple executions in MLMD.
580
+ """Registers multiple executions in MLMD and Tflex backends .
566
581
567
582
Along with the execution:
568
583
- the input artifacts will be linked to the executions.
@@ -575,6 +590,8 @@ def register_executions(
575
590
input_and_params: A list of InputAndParams, which includes input_dicts
576
591
(dictionaries of artifacts. One execution will be registered for each of
577
592
the input_dict) and corresponding exec_properties.
593
+ pipeline: Optional. The pipeline proto.
594
+ node_id: Optional. The node id of the executions to be registered.
578
595
579
596
Returns:
580
597
A list of MLMD executions that are registered in MLMD, with id populated.
@@ -603,21 +620,35 @@ def register_executions(
603
620
executions .append (execution )
604
621
605
622
if len (executions ) == 1 :
606
- return [
623
+ new_executions = [
607
624
execution_lib .put_execution (
608
625
metadata_handle ,
609
626
executions [0 ],
610
627
contexts ,
611
628
input_artifacts = input_and_params [0 ].input_artifacts ,
612
629
)
613
630
]
631
+ else :
632
+ new_executions = execution_lib .put_executions (
633
+ metadata_handle ,
634
+ executions ,
635
+ contexts ,
636
+ [
637
+ input_and_param .input_artifacts
638
+ for input_and_param in input_and_params
639
+ ],
640
+ )
614
641
615
- return execution_lib .put_executions (
616
- metadata_handle ,
617
- executions ,
618
- contexts ,
619
- [input_and_param .input_artifacts for input_and_param in input_and_params ],
620
- )
642
+ pipeline_asset = metadata_handle .store .pipeline_asset
643
+ if pipeline_asset and pipeline and node_id :
644
+ env .get_env ().create_pipeline_run_node_executions (
645
+ pipeline_asset .owner ,
646
+ pipeline_asset .name ,
647
+ pipeline ,
648
+ node_id ,
649
+ new_executions ,
650
+ )
651
+ return new_executions
621
652
622
653
623
654
def update_external_artifact_type (
0 commit comments