class_docstr: Responsible for launching a container executor.
class_docstr_tok: ["Responsible","for","launching","a","container","executor","."]
docstr: Converts DockerPlatformConfig to args acceppted by the containers.run.
docstr_tok: ["Converts","DockerPlatformConfig","to","args","acceppted","by","the","containers.run","."]
code: def _build_run_args(
      self,
      docker_platform_config: platform_config_pb2.DockerPlatformConfig,
  ) -> Dict[str, Any]:
      """Converts DockerPlatformConfig to args acceppted by the containers.run."""
      if docker_platform_config.additional_run_args:
          result = dict(docker_platform_config.additional_run_args)
      else:
          result = {}
      result.update(
          privileged=(docker_platform_config.privileged or False)
      )
      if docker_platform_config.environment:
          result.update(environment=docker_platform_config.environment)
      if docker_platform_config.name:
          result.update(name=docker_platform_config.name)
      if docker_platform_config.user:
          if docker_platform_config.user.username:
              result.update(user=docker_platform_config.user.username)
          else:
              result.update(user=docker_platform_config.user.uid)
      if docker_platform_config.volumes:
          volumes = {}
          for volume_name in docker_platform_config.volumes:
              volume_mount_pb = docker_platform_config.volumes[
                  volume_name
              ]
              volumes[volume_name] = {
                  "bind": volume_mount_pb.bind,
                  "mode": volume_mount_pb.mode,
              }
          result.update(volumes=volumes)
      return result
  
file_path: tfx/tfx/orchestration/portable/docker_executor_operator.py
imports: from typing import Any, Dict, Optional, cast
  from absl import logging
  import docker
  from tfx.dsl.compiler import placeholder_utils
  from tfx.dsl.component.experimental import executor_specs
  from tfx.orchestration.portable import base_executor_operator
  from tfx.orchestration.portable import data_types
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import platform_config_pb2
  from tfx.utils import proto_utils
  from google.protobuf import message
label_desc: Use image node_id 3 for calling the DockerExecutorOperator obj's underlying member method code with example usage: obj._build_run_args(docker_platform_config) and returns: result