class_docstr: Test tf.data service cluster.
class_docstr_tok: ["Test","tf.data","service","cluster","."]
docstr: Stops `dispatcher` and creates a new dispatcher with the same port.
  
  Restarting is supported only when the dispatcher is configured with
  `fault_tolerant_mode=True`.
docstr_tok: ["Stops","`","dispatcher","`","and","creates","a","new","dispatcher","with","the","same","port",".","Restarting","is","supported","only","when","the","dispatcher","is","configured","with","`","fault_tolerant_mode=True","`","."]
code: def restart_dispatcher(self):
      """Stops `dispatcher` and creates a new dispatcher with the same port.
  
      Restarting is supported only when the dispatcher is configured with
      `fault_tolerant_mode=True`.
      """
      if not self.dispatcher._config.fault_tolerant_mode:
          raise ValueError(
              "Trying to restart the dispatcher without fault-tolerance."
          )
      port = int(self.dispatcher_address().split(":")[1])
      self.dispatcher._stop()
      self.dispatcher = server_lib.DispatchServer(
          server_lib.DispatcherConfig(
              port=port,
              work_dir=self.dispatcher._config.work_dir,
              protocol=self._protocol,
              fault_tolerant_mode=self.dispatcher._config.fault_tolerant_mode,
              job_gc_check_interval_ms=self._job_gc_check_interval_ms,
              job_gc_timeout_ms=self._job_gc_timeout_ms,
              worker_timeout_ms=self._worker_timeout_ms,
              worker_max_concurrent_snapshots=self._worker_max_concurrent_snapshots,
          )
      )
  
imports: import tempfile
  from tensorflow.core.protobuf import service_config_pb2
  from tensorflow.python.data.experimental.ops import data_service_ops
  from tensorflow.python.data.experimental.service import server_lib
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 10 for calling the TestCluster obj's underlying member method code with example usage: obj.restart_dispatcher() without return types