-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow_jobs.py
More file actions
executable file
·36 lines (27 loc) · 1.34 KB
/
Copy pathshow_jobs.py
File metadata and controls
executable file
·36 lines (27 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
import subprocess
import numpy as np
from tabulate import tabulate
USERNAME = 'bras37867'
JOBNUM_CMD = "qstat -u "+USERNAME+" | tail -n+3 | awk '{print $1}'"
jobnums = subprocess.check_output(JOBNUM_CMD, stderr=subprocess.STDOUT, shell=True).split()
headers = ["job num","mu","beta","state","out file", "current mag"]
jobs = []
for job in jobnums:
job_name = subprocess.check_output("qstat -j "+job+" | grep job_name | awk '{print $2}'",
stderr=subprocess.STDOUT,
shell=True)
running = subprocess.check_output("qstat -u bras37867 | grep "+job+" | awk '{print $5}'",
stderr=subprocess.STDOUT,
shell = True)[:-1]
mu = float(job_name.split("_")[3][:-1])
beta = float(job_name.split("_")[2])
out_file = "B_"+str(beta)+"/MU_"+str(mu)+"/output*"
if running is "r":
current_mag = subprocess.check_output("cat "+out_file+" | grep Mag | awk '{print $2}' | tail -n 1",
stderr=subprocess.STDOUT,
shell=True)[:-1]
else:
current_mag = " "
jobs.append([job, mu, beta, running, out_file, current_mag])
print tabulate(jobs, headers=headers, tablefmt='orgtbl')