def node_stats_to_dict(message): decode_keys = { "actorId", "jobId", "taskId", "parentTaskId", "sourceActorId", "callerId", "rayletId", "workerId", "placementGroupId", } core_workers_stats = message.core_workers_stats message.ClearField("core_workers_stats") try: result = dashboard_utils.message_to_dict(message, decode_keys) result["coreWorkersStats"] = [ dashboard_utils.message_to_dict( m, decode_keys, including_default_value_fields=True ) for m in core_workers_stats ] return result finally: message.core_workers_stats.extend(core_workers_stats)
def actor_table_data_to_dict(message): return dashboard_utils.message_to_dict(message, { "actorId", "parentId", "jobId", "workerId", "rayletId", "actorCreationDummyObjectId", "callerId", "taskId", "parentTaskId", "sourceActorId", "placementGroupId" }, including_default_value_fields=True)
def _message_to_dict( self, *, message, fields_to_decode: List[str], preserving_proto_field_name: bool = True, ) -> dict: return dashboard_utils.message_to_dict( message, fields_to_decode, including_default_value_fields=True, preserving_proto_field_name=preserving_proto_field_name, )
def actor_table_data_to_dict(message): orig_message = dashboard_utils.message_to_dict( message, { "actorId", "parentId", "jobId", "workerId", "rayletId", "actorCreationDummyObjectId", "callerId", "taskId", "parentTaskId", "sourceActorId", "placementGroupId", }, including_default_value_fields=True, ) # The complete schema for actor table is here: # src/ray/protobuf/gcs.proto # It is super big and for dashboard, we don't need that much information. # Only preserve the necessary ones here for memory usage. fields = { "actorId", "jobId", "pid", "address", "state", "name", "numRestarts", "taskSpec", "timestamp", "numExecutedTasks", } light_message = {k: v for (k, v) in orig_message.items() if k in fields} if "taskSpec" in light_message: actor_class = actor_classname_from_task_spec(light_message["taskSpec"]) light_message["actorClass"] = actor_class if "functionDescriptor" in light_message["taskSpec"]: light_message["taskSpec"] = { "functionDescriptor": light_message["taskSpec"]["functionDescriptor"] } else: light_message.pop("taskSpec") return light_message
def gcs_node_info_to_dict(message): return dashboard_utils.message_to_dict(message, {"nodeId"}, including_default_value_fields=True)
def job_table_data_to_dict(message): decode_keys = {"jobId", "rayletId"} return dashboard_utils.message_to_dict( message, decode_keys, including_default_value_fields=True)