code: def worker(worker_args: WorkerArgs):
      """Entry point of a worker process.
  
      Computes minibatches in the main thread.
      """
      worker_context = WorkerContext(worker_args)
      try:
          while True:
              scheduled, shm_chunk = worker_context.get_task()
              if scheduled is None:
                  break
              callback = worker_context.get_callback(scheduled)
              try:
                  data_batch = callback(scheduled)
                  for sample in data_batch:
                      assert_valid_data_type(sample)
              except Exception as exception:
                  tb_str = traceback.format_exc()
                  processed = _WorkerProcessingResult.failed(
                      scheduled, shm_chunk, exception, tb_str
                  )
              else:
                  processed = _WorkerProcessingResult.done(
                      scheduled, shm_chunk, data_batch
                  )
              worker_context.dispatch(processed)
      finally:
          worker_context.close()
  
imports: from typing import List, Optional, Tuple
  import threading
  import traceback
  import socket
  from collections import deque
  from multiprocessing import reduction
  from nvidia.dali._utils.external_source_impl import SourceKind, _is_generator_function
  from nvidia.dali._multiproc.shared_batch import SharedBatchWriter, SharedBatchMeta, BufShmChunk, assert_valid_data_type, read_shm_message, write_shm_message
  from nvidia.dali._multiproc.messages import CompletedTask, WorkerArgs, ShmMessageDesc, ScheduledTask
  from nvidia.dali._multiproc.shared_queue import Dispatcher
label_desc: Use image node_id 2 for calling a global function with example usage: worker(worker_args) without return types