Ejemplo n.º 1
0
    def _task_table(self, task_id):
        """Fetch and parse the task table information for a single task ID.

        Args:
            task_id_binary: A string of bytes with the task ID to get
                information about.

        Returns:
            A dictionary with information about the task ID in question.
        """
        message = self._execute_command(task_id, "RAY.TABLE_LOOKUP",
                                        ray.gcs_utils.TablePrefix.RAYLET_TASK,
                                        "", task_id.id())
        gcs_entries = ray.gcs_utils.GcsTableEntry.GetRootAsGcsTableEntry(
            message, 0)

        assert gcs_entries.EntriesLength() == 1

        task_table_message = ray.gcs_utils.Task.GetRootAsTask(
            gcs_entries.Entries(0), 0)

        execution_spec = task_table_message.TaskExecutionSpec()
        task_spec = task_table_message.TaskSpecification()
        task_spec = ray.raylet.task_from_string(task_spec)
        function_descriptor_list = task_spec.function_descriptor_list()
        function_descriptor = FunctionDescriptor.from_bytes_list(
            function_descriptor_list)
        task_spec_info = {
            "DriverID": binary_to_hex(task_spec.driver_id().id()),
            "TaskID": binary_to_hex(task_spec.task_id().id()),
            "ParentTaskID": binary_to_hex(task_spec.parent_task_id().id()),
            "ParentCounter": task_spec.parent_counter(),
            "ActorID": binary_to_hex(task_spec.actor_id().id()),
            "ActorCreationID": binary_to_hex(
                task_spec.actor_creation_id().id()),
            "ActorCreationDummyObjectID": binary_to_hex(
                task_spec.actor_creation_dummy_object_id().id()),
            "ActorCounter": task_spec.actor_counter(),
            "Args": task_spec.arguments(),
            "ReturnObjectIDs": task_spec.returns(),
            "RequiredResources": task_spec.required_resources(),
            "FunctionID": binary_to_hex(function_descriptor.function_id.id()),
            "FunctionHash": binary_to_hex(function_descriptor.function_hash),
            "ModuleName": function_descriptor.module_name,
            "ClassName": function_descriptor.class_name,
            "FunctionName": function_descriptor.function_name,
        }

        return {
            "ExecutionSpec": {
                "Dependencies": [
                    execution_spec.Dependencies(i)
                    for i in range(execution_spec.DependenciesLength())
                ],
                "LastTimestamp": execution_spec.LastTimestamp(),
                "NumForwards": execution_spec.NumForwards()
            },
            "TaskSpec": task_spec_info
        }
Ejemplo n.º 2
0
    def _task_table(self, task_id):
        """Fetch and parse the task table information for a single task ID.

        Args:
            task_id: A task ID to get information about.

        Returns:
            A dictionary with information about the task ID in question.
        """
        assert isinstance(task_id, ray.TaskID)
        message = self._execute_command(task_id, "RAY.TABLE_LOOKUP",
                                        ray.gcs_utils.TablePrefix.RAYLET_TASK,
                                        "", task_id.binary())
        if message is None:
            return {}
        gcs_entries = ray.gcs_utils.GcsTableEntry.GetRootAsGcsTableEntry(
            message, 0)

        assert gcs_entries.EntriesLength() == 1

        task_table_message = ray.gcs_utils.Task.GetRootAsTask(
            gcs_entries.Entries(0), 0)

        execution_spec = task_table_message.TaskExecutionSpec()
        task_spec = task_table_message.TaskSpecification()
        task = ray._raylet.Task.from_string(task_spec)
        function_descriptor_list = task.function_descriptor_list()
        function_descriptor = FunctionDescriptor.from_bytes_list(
            function_descriptor_list)

        task_spec_info = {
            "DriverID":
            task.driver_id().hex(),
            "TaskID":
            task.task_id().hex(),
            "ParentTaskID":
            task.parent_task_id().hex(),
            "ParentCounter":
            task.parent_counter(),
            "ActorID": (task.actor_id().hex()),
            "ActorCreationID":
            task.actor_creation_id().hex(),
            "ActorCreationDummyObjectID":
            (task.actor_creation_dummy_object_id().hex()),
            "ActorCounter":
            task.actor_counter(),
            "Args":
            task.arguments(),
            "ReturnObjectIDs":
            task.returns(),
            "RequiredResources":
            task.required_resources(),
            "FunctionID":
            function_descriptor.function_id.hex(),
            "FunctionHash":
            binary_to_hex(function_descriptor.function_hash),
            "ModuleName":
            function_descriptor.module_name,
            "ClassName":
            function_descriptor.class_name,
            "FunctionName":
            function_descriptor.function_name,
        }

        return {
            "ExecutionSpec": {
                "Dependencies": [
                    execution_spec.Dependencies(i)
                    for i in range(execution_spec.DependenciesLength())
                ],
                "LastTimestamp":
                execution_spec.LastTimestamp(),
                "NumForwards":
                execution_spec.NumForwards()
            },
            "TaskSpec": task_spec_info
        }
Ejemplo n.º 3
0
    def _task_table(self, task_id):
        """Fetch and parse the task table information for a single task ID.

        Args:
            task_id: A task ID to get information about.

        Returns:
            A dictionary with information about the task ID in question.
        """
        assert isinstance(task_id, ray.TaskID)
        message = self._execute_command(
            task_id, "RAY.TABLE_LOOKUP",
            gcs_utils.TablePrefix.Value("RAYLET_TASK"), "", task_id.binary())
        if message is None:
            return {}
        gcs_entries = gcs_utils.GcsEntry.FromString(message)

        assert len(gcs_entries.entries) == 1
        task_table_data = gcs_utils.TaskTableData.FromString(
            gcs_entries.entries[0])

        task = ray._raylet.TaskSpec.from_string(
            task_table_data.task.task_spec.SerializeToString())
        function_descriptor_list = task.function_descriptor_list()
        function_descriptor = FunctionDescriptor.from_bytes_list(
            function_descriptor_list)

        task_spec_info = {
            "JobID":
            task.job_id().hex(),
            "TaskID":
            task.task_id().hex(),
            "ParentTaskID":
            task.parent_task_id().hex(),
            "ParentCounter":
            task.parent_counter(),
            "ActorID": (task.actor_id().hex()),
            "ActorCreationID":
            task.actor_creation_id().hex(),
            "ActorCreationDummyObjectID":
            (task.actor_creation_dummy_object_id().hex()),
            "ActorCounter":
            task.actor_counter(),
            "Args":
            task.arguments(),
            "ReturnObjectIDs":
            task.returns(),
            "RequiredResources":
            task.required_resources(),
            "FunctionID":
            function_descriptor.function_id.hex(),
            "FunctionHash":
            binary_to_hex(function_descriptor.function_hash),
            "ModuleName":
            function_descriptor.module_name,
            "ClassName":
            function_descriptor.class_name,
            "FunctionName":
            function_descriptor.function_name,
        }

        execution_spec = ray._raylet.TaskExecutionSpec.from_string(
            task_table_data.task.task_execution_spec.SerializeToString())
        return {
            "ExecutionSpec": {
                "Dependencies": execution_spec.dependencies(),
                "NumForwards": execution_spec.num_forwards(),
            },
            "TaskSpec": task_spec_info
        }