class_docstr: Kubeflow pipelines task builder.
  
  Constructs a pipeline task spec based on the TFX node information. Meanwhile,
  augments the deployment config associated with the node.
docstr: Builds the container spec for a component.
  
  Returns:
    The PipelineContainerSpec represents the container execution of the
    component.
  
  Raises:
    NotImplementedError: When the executor class is neither ExecutorClassSpec
    nor TemplatedExecutorContainerSpec.
docstr_tok: ["Builds","the","container","spec","for","a","component",".","Returns",":","The","PipelineContainerSpec","represents","the","container","execution","of","the","component",".","Raises",":","NotImplementedError",":","When","the","executor","class","is","neither","ExecutorClassSpec","nor","TemplatedExecutorContainerSpec","."]
code: def _build_container_spec(self) -> ContainerSpec:
      """Builds the container spec for a component.
  
      Returns:
        The PipelineContainerSpec represents the container execution of the
        component.
  
      Raises:
        NotImplementedError: When the executor class is neither ExecutorClassSpec
        nor TemplatedExecutorContainerSpec.
      """
  
      assert isinstance(self._node, base_component.BaseComponent)
  
      if self._node.platform_config:
          logging.info(
              "ResourceSpec with container execution parameters has been passed via platform_config"
          )
          assert isinstance(
              self._node.platform_config,
              pipeline_pb2.PipelineDeploymentConfig.PipelineContainerSpec.ResourceSpec,
          ), (
              "platform_config, if set by the user, must be a ResourceSpec proto "
              "specifying vCPU and vRAM requirements"
          )
          cpu_limit = self._node.platform_config.cpu_limit
          memory_limit = self._node.platform_config.memory_limit
          if cpu_limit:
              assert cpu_limit >= 0, "vCPU must be non-negative"
          if memory_limit:
              assert memory_limit >= 0, "vRAM must be non-negative"
  
          if self._node.platform_config.accelerator.type:
              assert (
                  self._node.platform_config.accelerator.count >= 0
              ), "GPU type and count must be set"
  
      if isinstance(
          self._node.executor_spec,
          executor_specs.TemplatedExecutorContainerSpec,
      ):
          container_spec = self._node.executor_spec
          result = ContainerSpec(
              image=container_spec.image,
              command=_resolve_command_line(
                  container_spec=container_spec,
                  exec_properties=self._node.exec_properties,
              ),
          )
          if self._node.platform_config:
              result.resources.CopyFrom(self._node.platform_config)
          return result
  
      # The container entrypoint format below assumes ExecutorClassSpec.
      if not isinstance(
          self._node.executor_spec, executor_spec.ExecutorClassSpec
      ):
          raise NotImplementedError(
              "Executor spec: % is not supported in Kubeflow V2 yet."
              "Currently only ExecutorClassSpec is supported."
          )
  
      result = ContainerSpec()
      result.image = self._tfx_image
      if self._image_cmds:
          for cmd in self._image_cmds:
              result.command.append(cmd)
      executor_path = name_utils.get_full_name(
          self._node.executor_spec.executor_class
      )
      # Resolve container arguments.
      result.args.append("--executor_class_path")
      result.args.append(executor_path)
      result.args.append("--json_serialized_invocation_args")
      result.args.append("{{$}}")
      result.args.extend(self._beam_pipeline_args)
  
      if self._node.platform_config:
          result.resources.CopyFrom(self._node.platform_config)
      return result
  
imports: import itertools
  from typing import Any, Dict, List, Optional, Tuple, cast
  from absl import logging
  from kfp.pipeline_spec import pipeline_spec_pb2
  from tfx import components
  from tfx.components.evaluator import constants
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.component.experimental import executor_specs
  from tfx.dsl.component.experimental import placeholders
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_node
  from tfx.dsl.components.base import executor_spec
  from tfx.dsl.components.common import importer
  from tfx.dsl.components.common import resolver
  from tfx.dsl.context_managers import dsl_context_registry
  from tfx.dsl.experimental.conditionals import conditional
  from tfx.dsl.input_resolution.strategies import latest_artifact_strategy
  from tfx.dsl.input_resolution.strategies import latest_blessed_model_strategy
  from tfx.dsl.placeholder import placeholder
  from tfx.orchestration import data_types
  from tfx.orchestration.kubeflow import decorators
  from tfx.orchestration.kubeflow import utils
  from tfx.orchestration.kubeflow.v2 import compiler_utils
  from tfx.orchestration.kubeflow.v2 import parameter_utils
  from tfx.types import channel_utils
  from tfx.types import standard_artifacts
  from tfx.types.channel import Channel
  from tfx.utils import deprecation_utils
  from tfx.utils import name_utils
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 3 for calling the StepBuilder obj's underlying member method code with example usage: obj._build_container_spec() and returns: result, result