code: def main_loop(self):
          
  
          def exit(signum, frame):
              shutdown()
              sys.exit(0)
  
          signal.signal(signal.SIGTERM, exit)
  
          while True:
              task = self._get_next_task_from_raylet()
              self._wait_for_and_process_task(task)
docs: The main loop a worker runs to receive and execute tasks.