class_docstr: A task scheduler for subpipeline.
docstr: Inserts an execution for the subpipeline begin node into MLMD.
  
  The new begin node execution is just forwarding the inputs to this
  subpipeline, which is possible via treaing the begin node as a Resolver,
  however because the begin node *actually* has tasks generated for it twice,
  once in the outer pipeline where the begin node is a pipeline-as-node, and
  once in the inner pipeline as a node, we don't want to regenerate tasks.
  
  Specifically, injecting the execution here is *required* for using ForEach,
  so that the multiple executions are only taken care of in the outer
  pipeline, and the inner pipeline only ever sees one artifact at a time from
  ForEach.
docstr_tok: ["Inserts","an","execution","for","the","subpipeline","begin","node","into","MLMD",".","The","new","begin","node","execution","is","just","forwarding","the","inputs","to","this","subpipeline",",","which","is","possible","via","treaing","the","begin","node","as","a","Resolver",",","however","because","the","begin","node","*","actually","*","has","tasks","generated","for","it","twice",",","once","in","the","outer","pipeline","where","the","begin","node","is","a","pipeline-as-node",",","and","once","in","the","inner","pipeline","as","a","node",",","we","do","n't","want","to","regenerate","tasks",".","Specifically",",","injecting","the","execution","here","is","*","required","*","for","using","ForEach",",","so","that","the","multiple","executions","are","only","taken","care","of","in","the","outer","pipeline",",","and","the","inner","pipeline","only","ever","sees","one","artifact","at","a","time","from","ForEach","."]
code: def _put_begin_node_execution(self):
      """Inserts an execution for the subpipeline begin node into MLMD.
  
      The new begin node execution is just forwarding the inputs to this
      subpipeline, which is possible via treaing the begin node as a Resolver,
      however because the begin node *actually* has tasks generated for it twice,
      once in the outer pipeline where the begin node is a pipeline-as-node, and
      once in the inner pipeline as a node, we don't want to regenerate tasks.
  
      Specifically, injecting the execution here is *required* for using ForEach,
      so that the multiple executions are only taken care of in the outer
      pipeline, and the inner pipeline only ever sees one artifact at a time from
      ForEach.
      """
      input_artifacts = self.task.input_artifacts
      begin_node = self._sub_pipeline.nodes[0].pipeline_node
      begin_node_execution = execution_lib.prepare_execution(
          metadata_handle=self.mlmd_handle,
          execution_type=begin_node.node_info.type,
          state=metadata_store_pb2.Execution.State.COMPLETE,
      )
      contexts = context_lib.prepare_contexts(
          metadata_handle=self.mlmd_handle,
          node_contexts=begin_node.contexts,
      )
      execution_lib.put_execution(
          metadata_handle=self.mlmd_handle,
          execution=begin_node_execution,
          contexts=contexts,
          input_artifacts=input_artifacts,
          output_artifacts=input_artifacts,
          output_event_type=metadata_store_pb2.Event.Type.INTERNAL_OUTPUT,
      )
  
imports: import copy
  import threading
  from typing import Callable, Optional
  from absl import flags
  from absl import logging
  from tfx.orchestration import metadata
  from tfx.orchestration.experimental.core import pipeline_ops
  from tfx.orchestration.experimental.core import pipeline_state
  from tfx.orchestration.experimental.core import task
  from tfx.orchestration.experimental.core import task_scheduler
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import status
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 3 for calling the SubPipelineTaskScheduler obj's underlying member method code with example usage: obj._put_begin_node_execution() without return types