in src/slurm_plugin/cluster_event_publisher.py [0:0]
def publish_compute_node_events(self, compute_nodes: List[SlurmNode], cluster_instances: List[any]):
"""Publish events for compute fleet nodes."""
current_time = ClusterEventPublisher.current_time()
timestamp = current_time.isoformat(timespec="milliseconds")
static_nodes = []
dynamic_nodes = []
for node in compute_nodes:
if node.is_idle():
(static_nodes if isinstance(node, StaticNode) else dynamic_nodes).append(node)
self.publish_event(
logging.INFO if dynamic_nodes else logging.DEBUG,
**COMPUTE_NODE_IDLE_TIME,
timestamp=timestamp,
event_supplier=self._idle_node_suppler("dynamic", current_time, dynamic_nodes),
)
self.publish_event(
logging.INFO if static_nodes else logging.DEBUG,
**COMPUTE_NODE_IDLE_TIME,
timestamp=timestamp,
event_supplier=self._idle_node_suppler("static", current_time, static_nodes),
)
self.publish_event(
logging.DEBUG,
**COMPUTE_NODE_STATE_COUNT,
timestamp=timestamp,
event_supplier=self._node_state_count_supplier(compute_nodes),
)
self.publish_event(
logging.DEBUG,
**CLUSTER_INSTANCE_COUNT,
timestamp=timestamp,
detail={
"count": len(cluster_instances) if cluster_instances else 0,
},
)
self.publish_event(
logging.DEBUG,
**COMPUTE_NODE_STATE,
timestamp=timestamp,
event_supplier=({"detail": self._describe_node(node)} for node in compute_nodes),
)