code: def compute_worker_fn(compute_config: TfDataServiceConfig):
      """Function run on the compute tasks providing tf dispatcher and worker server."""
      hvd.init()
      index, size = hvd.rank(), hvd.size()
      dispatcher_index = index // compute_config.workers_per_dispatcher
  
      compute = compute_config.compute_client(verbose=2)
  
      import tensorflow as tf
  
      # Create dispatcher for train task
      dispatcher_server = None
      if (
          compute_config.dispatcher_side == "compute"
          and index % compute_config.workers_per_dispatcher == 0
      ):
          if compute_config.dispatchers == 1:
              logging.info(f"Setting up Dispatcher for all tasks")
          else:
              logging.info(
                  f"Setting up Dispatcher for task {dispatcher_index}"
              )
  
          dispatcher_server = (
              tf.data.experimental.service.DispatchServer()
          )
          logging.debug(
              f"Registering Dispatcher {dispatcher_index} at {dispatcher_server.target}"
          )
          compute.register_dispatcher(
              dispatcher_index, dispatcher_server.target
          )
          logging.info(
              f"Registered Dispatcher {dispatcher_index} at {dispatcher_server.target}"
          )
  
      # Get dispatcher for the worker
      logging.debug(
          f"Waiting for dispatcher {dispatcher_index} for worker {index}"
      )
      dispatcher_address = compute.wait_for_dispatcher_registration(
          dispatcher_index, compute_config.timeout
      )
      logging.debug(
          f"Dispatcher {dispatcher_index} for worker {index} available"
      )
  
      # Create worker
      logging.debug(
          f"Setting up worker for dispatcher {dispatcher_index}"
      )
      worker_config = tf.data.experimental.service.WorkerConfig(
          dispatcher_address=dispatcher_address.split("://")[1],
          heartbeat_interval_ms=1000,
          dispatcher_timeout_ms=compute_config.timeout * 1000,
      )
      worker_server = tf.data.experimental.service.WorkerServer(
          worker_config
      )
      logging.debug(
          f"Starting worker for dispatcher {dispatcher_index}"
      )
      worker_server.start()
      logging.debug(f"Started worker for dispatcher {dispatcher_index}")
  
      # Tell the compute service that we are ready
      logging.debug(
          f"Registering worker for dispatcher {dispatcher_index}"
      )
      compute.register_worker_for_dispatcher(dispatcher_index, index)
      logging.info(
          f"Worker for dispatcher {dispatcher_index} registered"
      )
  
      # Wait until the compute service shuts down
      logging.debug(f"Waiting for shutdown request")
      compute.wait_for_shutdown()
      logging.debug(f"Shutdown requested")
  
      # stop the servers
      # there is currently no other way to stop the worker server
      logging.debug(f"Shuting down worker")
      worker_server._stop()
      worker_server.join()
      logging.info(f"Worker shut down")
      if dispatcher_server:
          # there is currently no other way to stop the dispatch server
          logging.debug(f"Shuting down dispatcher")
          dispatcher_server._stop()
          dispatcher_server.join()
          logging.info(f"Dispatcher shut down")
  
imports: import binascii
  import dataclasses
  import json
  import logging
  import os
  import time
  from contextlib import contextmanager
  from pathlib import Path
  from tempfile import NamedTemporaryFile
  from typing import Mapping, Sequence, Tuple, Any, Optional
  import tensorflow
  import horovod.tensorflow
  from horovod.runner.common.service.compute_service import ComputeClient
label_desc: Use image node_id 3 for calling a global function with example usage: compute_worker_fn(compute_config) without return types