code: def worker_job_webdataset(
      input_queue,
      metadata_sm,
      metadata_type,
      fields,
      allocator,
      done_number,
      allocations_queue,
      pipeline,
  ):
      metadata = np.frombuffer(metadata_sm.buf, dtype=metadata_type)
      field_names = metadata_type.names
  
      # This `with` block ensures that all the pages allocated have been written
      # onto the file
      with allocator:
          while True:
              todo = input_queue.get()
  
              if todo is None:
                  # No more work left to do
                  break
  
              shard, offset = todo
  
              # For each sample in the chunk
              done = 0
              for i, sample in enumerate(from_shard(shard, pipeline)):
                  done += 1
                  dest_ix = offset + i
                  handle_sample(
                      sample,
                      dest_ix,
                      field_names,
                      metadata,
                      allocator,
                      fields,
                  )
  
              # We warn the main thread of our progress
              with done_number.get_lock():
                  done_number.value += done
  
      allocations_queue.put(allocator.allocations)
  
imports: from functools import partial
  from typing import Callable, List, Mapping
  from os import SEEK_END, path
  import numpy
  from time import sleep
  import ctypes
  from multiprocessing import shared_memory, cpu_count, Queue, Process, Value
  from tqdm import tqdm
  from tqdm.contrib.concurrent import thread_map
  from .utils import chunks, is_power_of_2
  from .fields.base import Field
  from .memory_allocator import MemoryAllocator
  from .types import TYPE_ID_HANDLER, get_metadata_type, HeaderType, FieldDescType, CURRENT_VERSION, ALLOC_TABLE_TYPE
label_desc: Use image node_id 4 for calling a global function with example usage: worker_job_webdataset(input_queue, metadata_sm, metadata_type, fields, allocator, done_number, allocations_queue, pipeline) without return types