Commit 8d6ca798 authored by akhuziy's avatar akhuziy
Browse files

added the exit code to job's export info

parent af4f1a2c
...@@ -37,6 +37,11 @@ _info = { ...@@ -37,6 +37,11 @@ _info = {
"lsf": "RUN_TIME", "lsf": "RUN_TIME",
"slurm": "Elapsed", "slurm": "Elapsed",
"regex": "([0-9]+)"}, "regex": "([0-9]+)"},
"exit_code": {"rename": "exit_code",
"type": MType.INT,
"lsf": "EXIT_CODE",
"slurm": "ExitCode",
"regex": "([0-9]+):"},
"requested_time": {"rename": "requested_time", "requested_time": {"rename": "requested_time",
"type": MType.INT, "type": MType.INT,
"lsf": "RUNTIMELIMIT", "lsf": "RUNTIMELIMIT",
...@@ -201,7 +206,7 @@ def slurm_fetch_alloc_info(job_id): ...@@ -201,7 +206,7 @@ def slurm_fetch_alloc_info(job_id):
nodes_list = slurm_parse_nodes_info(nodes_list_raw) nodes_list = slurm_parse_nodes_info(nodes_list_raw)
cpu_count = slurm_parse_cpu_info(cpu_list_raw) cpu_count = slurm_parse_cpu_info(cpu_list_raw)
if re.match(r"[0-9]+", mem_alloc_raw): if re.match(r"[0-9]+", mem_alloc_raw):
mem_alloc = int(mem_alloc_raw) mem_alloc = int(mem_alloc_raw)
else: else:
mem_alloc = "" mem_alloc = ""
...@@ -213,6 +218,7 @@ def slurm_fetch_alloc_info(job_id): ...@@ -213,6 +218,7 @@ def slurm_fetch_alloc_info(job_id):
def parse_job_info_slurm(raw_data, alloc_info): def parse_job_info_slurm(raw_data, alloc_info):
time_fields = ["submit_time", "start_time", "end_time"] time_fields = ["submit_time", "start_time", "end_time"]
dur_fields = ["run_time", "requested_time"] dur_fields = ["run_time", "requested_time"]
reg_fields = ["exit_code"]
job_info = {} job_info = {}
for m, par in _info.items(): for m, par in _info.items():
...@@ -225,10 +231,14 @@ def parse_job_info_slurm(raw_data, alloc_info): ...@@ -225,10 +231,14 @@ def parse_job_info_slurm(raw_data, alloc_info):
# dates to timestamp # dates to timestamp
for f in time_fields: for f in time_fields:
if f == "end_time" and job_info[f] == "Unknown": if f == "end_time" and job_info[f] == "Unknown":
job_info[f] = 0 job_info[f] = 0
else: else:
job_info[f] = date_to_timestamp(job_info[f], "%Y-%m-%dT%H:%M:%S") job_info[f] = date_to_timestamp(job_info[f], "%Y-%m-%dT%H:%M:%S")
# regexes
for f in reg_fields:
job_info[f] = get_by_regex(job_info[f], _info[f]["regex"])
# slurm times to seconds # slurm times to seconds
for f in dur_fields: for f in dur_fields:
job_info[f] = slurm_time_to_sec(job_info[f]) job_info[f] = slurm_time_to_sec(job_info[f])
...@@ -328,7 +338,7 @@ def export_job_info(job_id): ...@@ -328,7 +338,7 @@ def export_job_info(job_id):
fdata = format_influx_db_out(job_id, job_info, alloc_info) fdata = format_influx_db_out(job_id, job_info, alloc_info)
payload = {'db': confdb.IDB["database"], 'precision': 's'} payload = {'db': confdb.IDB["database"], 'precision': 's'}
write_url = "{:s}/write".format(confdb.IDB["api_url"]) write_url = "{:s}/write".format(confdb.IDB["api_url"])
r = requests.post(write_url, auth=HTTPBasicAuth( r = requests.post(write_url, auth=HTTPBasicAuth(
confdb.IDB["username"], confdb.IDB["password"]), confdb.IDB["username"], confdb.IDB["password"]),
......
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