Created
June 2, 2022 22:05
-
-
Save InnovativeInventor/97f3e31b2ce0cb5248ed0e64799a1ac5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
""" | |
Example usage (on slurm cluster): | |
scontrol show nodes | python cores.py | sort -n | |
Outputs list of free cores per node, along with the load. | |
""" | |
for line in sys.stdin: | |
if "CPUTot" in line: | |
parsed = line.split() | |
try: | |
load = float(parsed[2].split("=")[1]) | |
if load > 1: | |
print(int(parsed[1].split("=")[1]) - int(parsed[0].split("=")[1]), "avail with load", load) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment