mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[dashboard] Remove unused fields in dashboard actor table for better memory footprint (#21919)
This commit is contained in:
parent
e6bbafc17a
commit
7d2237bc9f
2 changed files with 30 additions and 27 deletions
|
@ -67,28 +67,12 @@ export type TaskSpec = {
|
||||||
|
|
||||||
export type Actor = {
|
export type Actor = {
|
||||||
actorId: string;
|
actorId: string;
|
||||||
children: { [key: string]: Actor };
|
|
||||||
taskSpec: TaskSpec;
|
|
||||||
ipAddress: string;
|
|
||||||
isDirectCall: boolean;
|
|
||||||
jobId: string;
|
jobId: string;
|
||||||
numExecutedTasks: number;
|
|
||||||
numLocalObjects: number;
|
|
||||||
numObjectIdsInScope: number;
|
|
||||||
state: ActorEnum | string; // PENDING, ALIVE, RECONSTRUCTING, DEAD
|
state: ActorEnum | string; // PENDING, ALIVE, RECONSTRUCTING, DEAD
|
||||||
taskQueueLength: number;
|
|
||||||
usedObjectStoreMemory: number;
|
|
||||||
usedResources: { [key: string]: string | number };
|
|
||||||
timestamp: number;
|
|
||||||
actorTitle: string;
|
|
||||||
averageTaskExecutionSpeed: number;
|
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
pid: number;
|
pid: number;
|
||||||
ownerAddress: Address;
|
|
||||||
address: Address;
|
address: Address;
|
||||||
maxReconstructions: string;
|
|
||||||
remainingReconstructions: string;
|
|
||||||
isDetached: false;
|
|
||||||
name: string;
|
name: string;
|
||||||
numRestarts: string;
|
numRestarts: string;
|
||||||
|
taskSpec: TaskSpec;
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,13 +29,41 @@ routes = dashboard_optional_utils.ClassMethodRouteTable
|
||||||
|
|
||||||
|
|
||||||
def actor_table_data_to_dict(message):
|
def actor_table_data_to_dict(message):
|
||||||
return dashboard_utils.message_to_dict(
|
orig_message = dashboard_utils.message_to_dict(
|
||||||
message, {
|
message, {
|
||||||
"actorId", "parentId", "jobId", "workerId", "rayletId",
|
"actorId", "parentId", "jobId", "workerId", "rayletId",
|
||||||
"actorCreationDummyObjectId", "callerId", "taskId", "parentTaskId",
|
"actorCreationDummyObjectId", "callerId", "taskId", "parentTaskId",
|
||||||
"sourceActorId", "placementGroupId"
|
"sourceActorId", "placementGroupId"
|
||||||
},
|
},
|
||||||
including_default_value_fields=True)
|
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
|
||||||
|
|
||||||
|
|
||||||
class ActorHead(dashboard_utils.DashboardHeadModule):
|
class ActorHead(dashboard_utils.DashboardHeadModule):
|
||||||
|
@ -62,13 +90,6 @@ class ActorHead(dashboard_utils.DashboardHeadModule):
|
||||||
self._stubs[node_id] = stub
|
self._stubs[node_id] = stub
|
||||||
|
|
||||||
async def _update_actors(self):
|
async def _update_actors(self):
|
||||||
# TODO(fyrestone): Refactor code for updating actor / node / job.
|
|
||||||
|
|
||||||
def _process_actor_table_data(data):
|
|
||||||
actor_class = actor_classname_from_task_spec(
|
|
||||||
data.get("taskSpec", {}))
|
|
||||||
data["actorClass"] = actor_class
|
|
||||||
|
|
||||||
# Get all actor info.
|
# Get all actor info.
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -80,7 +101,6 @@ class ActorHead(dashboard_utils.DashboardHeadModule):
|
||||||
actors = {}
|
actors = {}
|
||||||
for message in reply.actor_table_data:
|
for message in reply.actor_table_data:
|
||||||
actor_table_data = actor_table_data_to_dict(message)
|
actor_table_data = actor_table_data_to_dict(message)
|
||||||
_process_actor_table_data(actor_table_data)
|
|
||||||
actors[actor_table_data["actorId"]] = actor_table_data
|
actors[actor_table_data["actorId"]] = actor_table_data
|
||||||
# Update actors.
|
# Update actors.
|
||||||
DataSource.actors.reset(actors)
|
DataSource.actors.reset(actors)
|
||||||
|
@ -113,7 +133,6 @@ class ActorHead(dashboard_utils.DashboardHeadModule):
|
||||||
|
|
||||||
def process_actor_data_from_pubsub(actor_id, actor_table_data):
|
def process_actor_data_from_pubsub(actor_id, actor_table_data):
|
||||||
actor_table_data = actor_table_data_to_dict(actor_table_data)
|
actor_table_data = actor_table_data_to_dict(actor_table_data)
|
||||||
_process_actor_table_data(actor_table_data)
|
|
||||||
# If actor is not new registered but updated, we only update
|
# If actor is not new registered but updated, we only update
|
||||||
# states related fields.
|
# states related fields.
|
||||||
if actor_table_data["state"] != "DEPENDENCIES_UNREADY":
|
if actor_table_data["state"] != "DEPENDENCIES_UNREADY":
|
||||||
|
|
Loading…
Add table
Reference in a new issue