class_docstr: Kubeflow Pipelines runner.
  
  Constructs a pipeline definition YAML file based on the TFX logical pipeline.
class_docstr_tok: ["Kubeflow","Pipelines","runner",".","Constructs","a","pipeline","definition","YAML","file","based","on","the","TFX","logical","pipeline","."]
docstr: Initializes KubeflowDagRunner for compiling a Kubeflow Pipeline.
  
  Args:
    output_dir: An optional output directory into which to output the pipeline
      definition files. Defaults to the current working directory.
    output_filename: An optional output file name for the pipeline definition
      file. Defaults to pipeline_name.tar.gz when compiling a TFX pipeline.
      Currently supports .tar.gz, .tgz, .zip, .yaml, .yml formats. See
      https://github.com/kubeflow/pipelines/blob/181de66cf9fa87bcd0fe9291926790c400140783/sdk/python/kfp/compiler/compiler.py#L851
        for format restriction.
    config: An optional KubeflowDagRunnerConfig object to specify runtime
      configuration when running the pipeline under Kubeflow.
    pod_labels_to_attach: Optional set of pod labels to attach to GKE pod
      spinned up for this pipeline. Default to the 3 labels:
      1. add-pod-env: true,
      2. pipeline SDK type,
      3. pipeline unique ID,
      where 2 and 3 are instrumentation of usage tracking.
docstr_tok: ["Initializes","KubeflowDagRunner","for","compiling","a","Kubeflow","Pipeline",".","Args",":","output_dir",":","An","optional","output","directory","into","which","to","output","the","pipeline","definition","files",".","Defaults","to","the","current","working","directory",".","output_filename",":","An","optional","output","file","name","for","the","pipeline","definition","file",".","Defaults","to","pipeline_name.tar.gz","when","compiling","a","TFX","pipeline",".","Currently","supports",".tar.gz",",",".tgz",",",".zip",",",".yaml",",",".yml","formats",".","See","https",":","\/\/github.com\/kubeflow\/pipelines\/blob\/181de66cf9fa87bcd0fe9291926790c400140783\/sdk\/python\/kfp\/compiler\/compiler.py","#","L851","for","format","restriction",".","config",":","An","optional","KubeflowDagRunnerConfig","object","to","specify","runtime","configuration","when","running","the","pipeline","under","Kubeflow",".","pod_labels_to_attach",":","Optional","set","of","pod","labels","to","attach","to","GKE","pod","spinned","up","for","this","pipeline",".","Default","to","the","3","labels",":","1.","add-pod-env",":","true",",","2.","pipeline","SDK","type",",","3.","pipeline","unique","ID",",","where","2","and","3","are","instrumentation","of","usage","tracking","."]
code: def __init__(
      self,
      output_dir: Optional[str] = None,
      output_filename: Optional[str] = None,
      config: Optional[KubeflowDagRunnerConfig] = None,
      pod_labels_to_attach: Optional[Dict[str, str]] = None,
  ):
      """Initializes KubeflowDagRunner for compiling a Kubeflow Pipeline.
  
      Args:
        output_dir: An optional output directory into which to output the pipeline
          definition files. Defaults to the current working directory.
        output_filename: An optional output file name for the pipeline definition
          file. Defaults to pipeline_name.tar.gz when compiling a TFX pipeline.
          Currently supports .tar.gz, .tgz, .zip, .yaml, .yml formats. See
          https://github.com/kubeflow/pipelines/blob/181de66cf9fa87bcd0fe9291926790c400140783/sdk/python/kfp/compiler/compiler.py#L851
            for format restriction.
        config: An optional KubeflowDagRunnerConfig object to specify runtime
          configuration when running the pipeline under Kubeflow.
        pod_labels_to_attach: Optional set of pod labels to attach to GKE pod
          spinned up for this pipeline. Default to the 3 labels:
          1. add-pod-env: true,
          2. pipeline SDK type,
          3. pipeline unique ID,
          where 2 and 3 are instrumentation of usage tracking.
      """
      if config and not isinstance(config, KubeflowDagRunnerConfig):
          raise TypeError(
              "config must be type of KubeflowDagRunnerConfig."
          )
      super().__init__(config or KubeflowDagRunnerConfig())
      self._config = cast(KubeflowDagRunnerConfig, self._config)
      self._output_dir = output_dir or os.getcwd()
      self._output_filename = output_filename
      self._compiler = compiler.Compiler()
      self._tfx_compiler = tfx_compiler.Compiler()
      self._params = (
          []
      )  # List of dsl.PipelineParam used in this pipeline.
      self._params_by_component_id = collections.defaultdict(list)
      self._deduped_parameter_names = (
          set()
      )  # Set of unique param names used.
      self._exit_handler = None
      if pod_labels_to_attach is None:
          self._pod_labels_to_attach = get_default_pod_labels()
      else:
          self._pod_labels_to_attach = pod_labels_to_attach
  
imports: import collections
  import copy
  import os
  from typing import Any, Callable, Dict, List, Optional, Type, cast, MutableMapping
  from absl import logging
  from kfp import compiler
  from kfp import dsl
  from kfp import gcp
  from kubernetes import client
  from tfx import version
  from tfx.dsl.compiler import compiler
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_node
  from tfx.orchestration import data_types
  from tfx.orchestration import pipeline
  from tfx.orchestration import tfx_runner
  from tfx.orchestration.config import pipeline_config
  from tfx.orchestration.kubeflow import base_component
  from tfx.orchestration.kubeflow import utils
  from tfx.orchestration.kubeflow.proto import kubeflow_pb2
  from tfx.orchestration.launcher import base_component_launcher
  from tfx.orchestration.launcher import in_process_component_launcher
  from tfx.orchestration.launcher import kubernetes_component_launcher
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import telemetry_utils
label_desc: Use image node_id 1 to create a new KubeflowDagRunner object from inherited base classes: tfx_runner with example: obj = KubeflowDagRunner(output_dir, output_filename, config, pod_labels_to_attach)