Skip to content

Commit

Permalink
more pr feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Owen <[email protected]>
  • Loading branch information
omatthew98 committed Feb 6, 2025
1 parent 86a28c0 commit 4ebf082
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ class RunningTaskInfo:

@dataclass
class NodeMetrics:
num_tasks_submitted: int = field(default=0)
num_tasks_running: int = field(default=0)
num_tasks_finished: int = field(default=0)
obj_store_mem_used: int = field(default=0)
obj_store_mem_freed: int = field(default=0)
obj_store_mem_spilled: int = field(default=0)
bytes_outputs_of_finished_tasks: int = field(default=0)
blocks_outputs_of_finished_tasks: int = field(default=0)
num_tasks_submitted: int = 0
num_tasks_running: int = 0
num_tasks_finished: int = 0
obj_store_mem_used: int = 0
obj_store_mem_freed: int = 0
obj_store_mem_spilled: int = 0
bytes_outputs_of_finished_tasks: int = 0
blocks_outputs_of_finished_tasks: int = 0


class OpRuntimesMetricsMeta(type):
Expand Down
8 changes: 7 additions & 1 deletion python/ray/data/_internal/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,13 @@ def _run_update_loop():
def _aggregate_per_node_metrics(
self, op_metrics: List[OpRuntimeMetrics]
) -> Optional[Mapping[str, Mapping[str, Union[int, float]]]]:
# Do not attempt to aggregate per node metrics if they are disabled.
"""
Aggregate per-node metrics from a list of OpRuntimeMetrics objects.
If per-node metrics are disabled in the current DataContext, returns None.
Otherwise, it sums up all NodeMetrics fields across the provided metrics and
returns a nested dictionary mapping each node ID to a dict of field values.
"""
if not DataContext.get_current().enable_per_node_metrics:
return None

Expand Down

0 comments on commit 4ebf082

Please sign in to comment.