Commit 7e776208 authored by akhuziy's avatar akhuziy
Browse files

added array JOBID transformation for Slurm

parent 071e8c8f
......@@ -22,9 +22,10 @@ measurements = {
"gpu_proc": 'nvidia_proc',
}
SLURM_BIN = "" # FULL path to Slurm binaries
# Security
#############################
SLURM_BIN = "" # FULL path to Slurm binaries
LSF_BIN = ""
SECUSER = True # use setuid binary and check users before fetching data
job_uid_comm = {
......@@ -32,6 +33,14 @@ job_uid_comm = {
"slurm": SLURM_BIN + "sacct -j {jobid:s} -X -P -n -o \"uid\"",
}
# Array JOBID transformation
#############################
JOBID_ARRAY_TRANSFORM = True
jobid_array_trans_comm = {
"slurm": SLURM_BIN + "sacct -j {jobid:s} -X -P -n -o \"JobIDRaw\"",
"lsf": "NOT SUPPORTED"
}
# DB
#############################
CACHEJSON = False # cache aggregated results as json file
......
......@@ -95,6 +95,31 @@ def check_user(jobid):
return
def job_id_transform(jobid):
if "_" not in jobid:
return jobid
if conf.BATCH_SYSTEM == "SLURM":
jobid_comm = conf.jobid_array_trans_comm["slurm"].format(jobid = jobid)
elif conf.BATCH_SYSTEM == "LSF":
return jobid
else:
print("Cannot transform JOBID, no batch system specified")
exit(1)
result = subprocess.run(jobid_comm, stdout=subprocess.PIPE, shell=True,
executable='/bin/bash')
out = result.stdout.decode("utf-8")
m = re.search("[0-9]+", out)
if m is None or m.group(0) is None:
print("Cannot parse JOBID. {:s}".format(out))
exit(1)
raw_job_id = m.group(0)
return raw_job_id
def check_cache_file(jobid, filename):
if conf.CACHEJSON is False or conf.CACHEDIR == "":
return False
......@@ -155,6 +180,9 @@ def main():
exit()
# End of errors in arguments
if conf.JOBID_ARRAY_TRANSFORM:
job_id = job_id_transform(job_id)
# initial values
need_to_aggregate = True
cache = {"text": False, "pdf": False}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment