Exemplo n.º 1
0
    def _object_table(self, object_id):
        """Fetch and parse the object table information for a single object ID.

    Args:
      object_id_binary: A string of bytes with the object ID to get information
        about.

    Returns:
      A dictionary with information about the object ID in question.
    """
        # Return information about a single object ID.
        object_locations = self._execute_command(object_id,
                                                 "RAY.OBJECT_TABLE_LOOKUP",
                                                 object_id.id())
        if object_locations is not None:
            manager_ids = [
                binary_to_hex(manager_id) for manager_id in object_locations
            ]
        else:
            manager_ids = None

        result_table_response = self._execute_command(
            object_id, "RAY.RESULT_TABLE_LOOKUP", object_id.id())
        result_table_message = ResultTableReply.GetRootAsResultTableReply(
            result_table_response, 0)

        result = {
            "ManagerIDs": manager_ids,
            "TaskID": binary_to_hex(result_table_message.TaskId()),
            "IsPut": bool(result_table_message.IsPut())
        }

        return result
Exemplo n.º 2
0
    def _object_table(self, object_id):
        """Fetch and parse the object table information for a single object ID.

        Args:
            object_id_binary: A string of bytes with the object ID to get
                information about.

        Returns:
            A dictionary with information about the object ID in question.
        """
        # Allow the argument to be either an ObjectID or a hex string.
        if not isinstance(object_id, ray.local_scheduler.ObjectID):
            object_id = ray.local_scheduler.ObjectID(hex_to_binary(object_id))

        # Return information about a single object ID.
        object_locations = self._execute_command(object_id,
                                                 "RAY.OBJECT_TABLE_LOOKUP",
                                                 object_id.id())
        if object_locations is not None:
            manager_ids = [
                binary_to_hex(manager_id) for manager_id in object_locations
            ]
        else:
            manager_ids = None

        result_table_response = self._execute_command(
            object_id, "RAY.RESULT_TABLE_LOOKUP", object_id.id())
        result_table_message = ResultTableReply.GetRootAsResultTableReply(
            result_table_response, 0)

        result = {
            "ManagerIDs": manager_ids,
            "TaskID": binary_to_hex(result_table_message.TaskId()),
            "IsPut": bool(result_table_message.IsPut()),
            "DataSize": result_table_message.DataSize(),
            "Hash": binary_to_hex(result_table_message.Hash())
        }

        return result
Exemplo n.º 3
0
 def check_result_table_entry(message, task_id, is_put):
   result_table_reply = ResultTableReply.GetRootAsResultTableReply(message,
                                                                   0)
   self.assertEqual(result_table_reply.TaskId(), task_id)
   self.assertEqual(result_table_reply.IsPut(), is_put)