Skip to content

Instantly share code, notes, and snippets.

@jklymak
Created March 12, 2021 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jklymak/2f1dd7307ec931471e9138afaae2e834 to your computer and use it in GitHub Desktop.
Save jklymak/2f1dd7307ec931471e9138afaae2e834 to your computer and use it in GitHub Desktop.
getting status from MITGCM on slurm
import sys
import os
import subprocess
os.system('sq')
out=subprocess.check_output('squeue -h -t RUNNING -u jklymak --Format="Name:50"',
shell=True, text=True)
out = out.splitlines()
# print(out)
for dd in out:
dd = dd.strip()
os.system(f"grep -E 'advcfl_wvel_max|time_seconds|dynstat_uvel_max' ../results/{dd}/input/STDOUT.0000 | tail -n 9")
ot = subprocess.check_output(f"grep -E 'time_seconds' ../results/{dd}/input/STDOUT.0000 | tail -n 1",
shell=True, text=True)
st = ot.split(' ')[-1]
days = float(st)/24/3600
print(f'{float(st)} seconds')
print(f'{days:6.2f} days')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment