code: def _wait_for_function(self, function_descriptor, driver_id, timeout=10):
          
          start_time = time.time()
          # Only send the warning once.
          warning_sent = False
          while True:
              with self.lock:
                  if (self._worker.actor_id.is_nil()
                          and (function_descriptor.function_id in
                               self._function_execution_info[driver_id])):
                      break
                  elif not self._worker.actor_id.is_nil() and (
                          self._worker.actor_id in self._worker.actors):
                      break
              if time.time() - start_time > timeout:
                  warning_message = ("This worker was asked to execute a "
                                     "function that it does not have "
                                     "registered. You may have to restart "
                                     "Ray.")
                  if not warning_sent:
                      ray.utils.push_error_to_driver(
                          self._worker,
                          ray_constants.WAIT_FOR_FUNCTION_PUSH_ERROR,
                          warning_message,
                          driver_id=driver_id)
                  warning_sent = True
              time.sleep(0.001)
docs: Wait until the function to be executed is present on this worker.
  
          This method will simply loop until the import thread has imported the
          relevant function. If we spend too long in this loop, that may indicate
          a problem somewhere and we will push an error message to the user.
  
          If this worker is an actor, then this will wait until the actor has
          been defined.
  
          Args:
              function_descriptor : The FunctionDescriptor of the function that
                  we want to execute.
              driver_id (str): The ID of the driver to push the error message to
                  if this times out.