code: def _deferred_pool_runner(
      has_chief, num_workers, initializer=None, share_gpu=True
  ):
      """Returns a callable that returns the pool runner.
  
      It creates the pool runner only upon first invocation. This avoids creating it
      when this file is imported.
  
      Args:
        has_chief: whether there should be a chief.
        num_workers: the number of workers excluding the chief.
        initializer: initializer of each process.
        share_gpu: whether to share GPU between the workers.
  
      Returns:
        A callable that returns the runner.
      """
  
      container = []
  
      def get_or_create():
          if not container:
              cluster_spec = multi_worker_test_base.create_cluster_spec(
                  has_chief=has_chief,
                  num_workers=num_workers,
                  num_ps=0,
                  has_eval=False,
              )
              runner = multi_process_runner.MultiProcessPoolRunner(
                  cluster_spec,
                  initializer=initializer,
                  share_gpu=share_gpu,
              )
              container.append(runner)
          return container[0]
  
      return get_or_create
  
imports: import sys
  import unittest
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python import tf2
  from tensorflow.python.distribute import central_storage_strategy
  from tensorflow.python.distribute import cluster_resolver
  from tensorflow.python.distribute import collective_all_reduce_strategy
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import mirrored_strategy
  from tensorflow.python.distribute import multi_process_runner
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.distribute import one_device_strategy
  from tensorflow.python.distribute import parameter_server_strategy_v2
  from tensorflow.python.distribute import sharded_variable
  from tensorflow.python.distribute import test_util
  from tensorflow.python.distribute import tpu_strategy
  from tensorflow.python.distribute.cluster_resolver import tpu_cluster_resolver
  from tensorflow.python.eager import context
  from tensorflow.python.eager import remote
  from tensorflow.python.framework import device
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import flags
  from tensorflow.python.tpu import device_assignment
  from tensorflow.python.training import server_lib
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 7 for calling a global function with example usage: _deferred_pool_runner(has_chief, num_workers, initializer, share_gpu) and returns: get_or_create, container