diff --git a/python/ray/autoscaler/_private/monitor.py b/python/ray/autoscaler/_private/monitor.py index 8db6404b0953..800668527c29 100644 --- a/python/ray/autoscaler/_private/monitor.py +++ b/python/ray/autoscaler/_private/monitor.py @@ -400,11 +400,15 @@ def _run(self): self.autoscaler.update() status["autoscaler_update_time"] = time.time() - update_start_time autoscaler_summary = self.autoscaler.summary() - self.emit_metrics( - load_metrics_summary, - autoscaler_summary, - self.autoscaler.all_node_types, - ) + try: + self.emit_metrics( + load_metrics_summary, + autoscaler_summary, + self.autoscaler.all_node_types, + ) + except Exception: + logger.exception("Error emitting metrics") + if autoscaler_summary: status["autoscaler_report"] = asdict(autoscaler_summary) status[ @@ -464,7 +468,7 @@ def emit_metrics(self, load_metrics_summary, autoscaler_summary, node_types): for _, node_type, _ in autoscaler_summary.pending_nodes: pending_node_count[node_type] += 1 - for node_type, count in autoscaler_summary.pending_launches: + for node_type, count in autoscaler_summary.pending_launches.items(): pending_node_count[node_type] += count for node_type in node_types: