Commit b81917e4 authored by Azat Khuziyakhmetov's avatar Azat Khuziyakhmetov
Browse files

fixed another bug with slurm time parsing

parent 32b2f2a4
......@@ -128,20 +128,20 @@ def slurm_time_to_sec(slurm_time):
if slurm_time is None:
return None
# 1:days, 2:hours, 3:minutes, 4:seconds
# 2:days, 4:hours, 5:minutes, 6:seconds
m = re.search(
"([0-9]{1,2})?-?([0-9]{2})?:?([0-9]{2}):([0-9]{2})", slurm_time)
"(([0-9]{1,2})-)?(([0-9]{2}):)?([0-9]{2}):([0-9]{2})", slurm_time)
if m.group(4) is None or m.group(3) is None:
if m.group(5) is None or m.group(6) is None:
raise ValueError("Couldn't parse time", slurm_time)
secs = int(m.group(3)) * 60 + int(m.group(4))
secs = int(m.group(5)) * 60 + int(m.group(6))
if m.group(2) is not None:
secs += int(m.group(2)) * 3600
if m.group(4) is not None:
secs += int(m.group(4)) * 3600
if m.group(1) is not None:
secs += int(m.group(1)) * 86400
if m.group(2) is not None:
secs += int(m.group(2)) * 86400
return secs
......@@ -319,7 +319,7 @@ def export_job_info(job_id):
fdata = format_influx_db_out(job_id, job_info, alloc_info)
payload = {'db': confdb.IDB["database"], 'precision': 's'}
print(fdata)
write_url = "{:s}/write".format(confdb.IDB["api_url"])
r = requests.post(write_url, auth=HTTPBasicAuth(
confdb.IDB["username"], confdb.IDB["password"]),
......
Supports Markdown
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