Ejemplo n.º 1
0
 def _schedule_function(self, task: ray_client_pb2.ClientTask,
                        context=None) -> ray_client_pb2.ClientTaskTicket:
     remote_func = self.lookup_or_register_func(
         task.payload_id, task.client_id,
         decode_options(task.baseline_options))
     arglist, kwargs = self._convert_args(task.args, task.kwargs)
     opts = decode_options(task.options)
     if opts is not None:
         remote_func = remote_func.options(**opts)
     with current_server(self):
         output = remote_func.remote(*arglist, **kwargs)
     ids = self.unify_and_track_outputs(output, task.client_id)
     return ray_client_pb2.ClientTaskTicket(return_ids=ids)
Ejemplo n.º 2
0
    def _schedule_actor(self, task: ray_client_pb2.ClientTask,
                        context=None) -> ray_client_pb2.ClientTaskTicket:
        remote_class = self.lookup_or_register_actor(
            task.payload_id, task.client_id,
            decode_options(task.baseline_options))

        arglist, kwargs = self._convert_args(task.args, task.kwargs)
        opts = decode_options(task.options)
        if opts is not None:
            remote_class = remote_class.options(**opts)
        with current_server(self):
            actor = remote_class.remote(*arglist, **kwargs)
        self.actor_refs[actor._actor_id.binary()] = actor
        self.actor_owners[task.client_id].add(actor._actor_id.binary())
        return ray_client_pb2.ClientTaskTicket(
            return_ids=[actor._actor_id.binary()])