This repository has been archived on 2026-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
slurm-job-log-mailer/query_slurm_check.py
2019-06-27 16:53:49 +09:00

15 lines
472 B
Python

import subprocess as sp
USER = 'ignis'
idlist = sp.check_output('squeue -h -u {} -o "%i"'.format(USER), shell=True).split()
foamBanner='F ield | OpenFOAM: The Open Source CFD Toolbox'
for sid in idlist:
a = sp.check_output('scontrol show job {}'.format(sid), shell=True).split()
d = {aa.split("=")[0]: aa.split("=")[-1] for aa in a}
with open(d["StdOut"]) as logfile:
if logfile.read().find(foamBanner) >= 0:
print d["StdOut"]