docs: def process_worker(registry, verbose=False, jobdirs=False,
                     init=None, finish=None, status=True):
      """Process worker"""
      name = "process-" + str(uuid.uuid4())
  
      cmd = [sys.prefix + "/bin/python", "-m", "noodles.pilot_job",
             "-name", name, "-registry", object_name(registry)]
      if verbose:
          cmd.append("-verbose")
      if jobdirs:
          cmd.append("-jobdirs")
      if not status:
          cmd.append("-nostatus")
      if init:
          cmd.extend(["-init", object_name(init)])
      if finish:
          cmd.extend(["-finish", object_name(finish)])
  
      remote = Popen(
          cmd,
          stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
  
      def read_stderr():
          """Read stderr of remote process and sends lines to logger."""
          for line in remote.stderr:
              print(name + ": " + line.rstrip())
  
      stderr_reader_thread = threading.Thread(target=read_stderr, daemon=True)
      stderr_reader_thread.start()
  
      @push
      def send_job():
          """Coroutine, sends jobs to remote worker over standard input."""
          reg = registry()
  
          sink = JSONObjectWriter(reg, remote.stdin)
  
          while True:
              msg = yield
              if msg is EndOfQueue:
                  try:
                      sink.send(EndOfWork)
                  except StopIteration:
                      pass
  
                  remote.wait()
                  stderr_reader_thread.join()
  
                  return
  
              if msg is FlushQueue:
                  continue
  
              sink.send(msg)
  
      @pull
      def get_result():
          """Generator, reading results from process standard output."""
          reg = registry()
          yield from JSONObjectReader(reg, remote.stdout)
  
      return Connection(get_result, send_job)