Skip to content

Commit 30b1311

Browse files
committed
[Data] Handle distributions without sample counts
Signed-off-by: viiccwen <vicwen@apache.org>
1 parent 9fca653 commit 30b1311

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

python/ray/data/_internal/stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ def _record(
758758
if isinstance(value, RuntimeMetricsHistogram):
759759
value.export_to(prom_metric, tags)
760760
elif isinstance(prom_metric, dict) and isinstance(value, dict):
761-
if value.get("num_samples", 0) == 0:
761+
if value.get("num_samples") == 0:
762762
return
763763
for statistic, gauge in prom_metric.items():
764764
statistic_value = value.get(statistic)

python/ray/data/tests/test_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ def test_stats_actor_exports_distribution_metrics():
20352035

20362036
actor.update_execution_metrics(
20372037
"dataset_1",
2038-
[{"max_uss_bytes": {"num_samples": 2, "mean": 200, "max": 300}}],
2038+
[{"max_uss_bytes": {"mean": 200, "max": 300}}],
20392039
["MapBatches_1"],
20402040
{},
20412041
)

0 commit comments

Comments
 (0)