def task_table(self, task_id=None): """Fetch and parse the task table information for one or more task IDs. Args: task_id: A hex string of the task ID to fetch information about. If this is None, then the task object table is fetched. Returns: Information from the task table. """ self._check_connected() if task_id is not None: task_id = ray.TaskID(hex_to_binary(task_id)) return self._task_table(task_id) else: task_table_keys = self._keys( gcs_utils.TablePrefix_RAYLET_TASK_string + "*") task_ids_binary = [ key[len(gcs_utils.TablePrefix_RAYLET_TASK_string):] for key in task_table_keys ] results = {} for task_id_binary in task_ids_binary: results[binary_to_hex(task_id_binary)] = self._task_table( ray.TaskID(task_id_binary)) return results
def _task_table_shard(shard_index): redis_client = ray.global_state.redis_clients[shard_index] task_table_keys = redis_client.keys(TASK_PREFIX + b"*") results = {} for key in task_table_keys: task_id_binary = key[len(TASK_PREFIX):] results[binary_to_hex(task_id_binary)] = ray.global_state._task_table( ray.TaskID(task_id_binary)) return results
def binary_to_task_id(binary_task_id): return ray.TaskID(binary_task_id)