def _describe_node()

in src/slurm_plugin/cluster_event_publisher.py [0:0]


    def _describe_node(node: SlurmNode):
        if not node:
            return {}
        node_states = list(node.state_string.split("+"))
        return (
            {
                "name": node.name,
                "type": "static" if isinstance(node, StaticNode) else "dynamic",
                "address": node.nodeaddr,
                "hostname": node.nodehostname,
                "state-string": node.state_string,
                "state-reason": node.reason,
                "state": node_states[0] if node_states else None,
                "state-flags": node_states[1:],
                "instance": ClusterEventPublisher._describe_instance(node.instance) if node.instance else None,
                "partitions": list(node.partitions),
                "queue-name": node.queue_name,
                "compute-resource": node.compute_resource_name,
                "last-busy-time": node.lastbusytime.isoformat(timespec="milliseconds") if node.lastbusytime else None,
                "slurm-started-time": (
                    node.slurmdstarttime.isoformat(timespec="milliseconds") if node.slurmdstarttime else None
                ),
            }
            if node
            else None
        )