class_docstr: A TPU pod command runner.
class_docstr_tok: ["A","TPU","pod","command","runner","."]
code: def __init__(
      self,
      instance: GCPTPUNode,
      log_prefix: str,
      node_id: str,
      auth_config: Dict[str, Any],
      provider: NodeProvider,
      cluster_name: str,
      process_runner: ModuleType,
      use_internal_ip: bool,
      docker_config: Optional[Dict[str, Any]] = None,
  ):
      def create_command_runner(
          worker_id: int,
          accelerator_type: str,
          internal_ip: str,
          external_ip: str,
      ) -> CommandRunnerInterface:
          """Returns the correct base command runner."""
  
          common_args = {
              "internal_ip": internal_ip,
              "external_ip": external_ip,
              "worker_id": worker_id,
              "accelerator_type": accelerator_type,
              "log_prefix": "[tpu_worker_{}] ".format(worker_id)
              + log_prefix,
              "node_id": node_id,
              "provider": provider,
              "auth_config": auth_config,
              "cluster_name": cluster_name,
              "process_runner": process_runner,
              "use_internal_ip": use_internal_ip,
          }
          if docker_config and docker_config["container_name"] != "":
              return TPUVMDockerCommandRunner(
                  docker_config=docker_config, **common_args
              )
          else:
              return TPUVMSSHCommandRunner(**common_args)
  
      self._command_runners = []
      self._num_workers = instance.num_workers
      for i in range(self._num_workers):
          self._command_runners.append(
              create_command_runner(
                  worker_id=i,
                  accelerator_type=instance.get("acceleratorType"),
                  internal_ip=instance.get_internal_ip(i),
                  external_ip=instance.get_external_ip(i),
              )
          )
  
imports: import copy
  from concurrent.futures import ThreadPoolExecutor
  from types import ModuleType
  from typing import Any, Dict, Optional
  from ray._private import ray_constants
  from ray.autoscaler._private.command_runner import DockerCommandRunner, SSHCommandRunner
  from ray.autoscaler._private.gcp.node import GCPTPUNode
  from ray.autoscaler.command_runner import CommandRunnerInterface
  from ray.autoscaler.node_provider import NodeProvider
label_desc: Use image node_id 1 to create a new TPUCommandRunner object from inherited base classes: CommandRunnerInterface with example: obj = TPUCommandRunner(instance, log_prefix, node_id, auth_config, provider, cluster_name, process_runner, use_internal_ip, docker_config)