in azure-slurm/slurmcc/cli.py [0:0]
def accounting_info(self, config: Dict, node_name: str) -> None:
node_mgr = self._get_node_manager(config)
nodes = node_mgr.get_nodes()
nodes_filtered = [n for n in nodes if n.name == node_name]
if not nodes_filtered:
json.dump([], sys.stdout)
return
assert len(nodes_filtered) == 1
node = nodes_filtered[0]
toks = check_output(["scontrol", "show", "node", node_name]).decode().split()
cpus = -1
for tok in toks:
tok = tok.lower()
if tok.startswith("cputot"):
cpus = int(tok.split("=")[1])
json.dump(
[
{
"name": node.name,
"location": node.location,
"vm_size": node.vm_size,
"spot": node.spot,
"nodearray": node.nodearray,
"cpus": cpus,
"pcpu_count": node.pcpu_count,
"vcpu_count": node.vcpu_count,
"gpu_count": node.gpu_count,
"memgb": node.memory.value,
}
],
sys.stdout
)