Commit 66bda5af authored by Azat Khuziyakhmetov's avatar Azat Khuziyakhmetov
Browse files

added a support to exit code status in aggregator

parent 8d6ca798
...@@ -70,6 +70,7 @@ class JobData: ...@@ -70,6 +70,7 @@ class JobData:
requested_time = None requested_time = None
requested_cu = None requested_cu = None
num_nodes = None num_nodes = None
exit_code = None
alloc_cu = [AllocCUData()] alloc_cu = [AllocCUData()]
class NodeData: class NodeData:
......
...@@ -48,10 +48,10 @@ def parse_alloc_res(alloc_info): ...@@ -48,10 +48,10 @@ def parse_alloc_res(alloc_info):
elif nres == 2: elif nres == 2:
cu = resources[0] cu = resources[0]
node_id = resources[1] node_id = resources[1]
alloc_mem[node_id] = -1 alloc_mem[node_id] = -1
else: else:
raise RuntimeError("Allocated resourses couldn't be parsed") raise RuntimeError("Allocated resourses couldn't be parsed")
fcu = common.format_metric(metrics.metrics_node, "alloc_cu", cu) fcu = common.format_metric(metrics.metrics_node, "alloc_cu", cu)
alloc_cu[node_id] = fcu alloc_cu[node_id] = fcu
...@@ -62,6 +62,10 @@ def format_job_info(jobinfo_init): ...@@ -62,6 +62,10 @@ def format_job_info(jobinfo_init):
for name, par in metrics.metrics_job.items(): for name, par in metrics.metrics_job.items():
raw_value = jobinfo_init.get("last_{:s}".format(par["dbname"]), None) raw_value = jobinfo_init.get("last_{:s}".format(par["dbname"]), None)
if name == "exit_code" and raw_value is None:
raw_value = -1
value = common.format_metric(metrics.metrics_job, name, raw_value) value = common.format_metric(metrics.metrics_job, name, raw_value)
jobinfo[name] = value jobinfo[name] = value
......
...@@ -52,6 +52,7 @@ def get_aggregator(job_id, type="text"): ...@@ -52,6 +52,7 @@ def get_aggregator(job_id, type="text"):
aggr.job.requested_time = jd.get("requested_time") aggr.job.requested_time = jd.get("requested_time")
aggr.job.requested_cu = jd.get("requested_cu") aggr.job.requested_cu = jd.get("requested_cu")
aggr.job.num_nodes = jd.get("num_nodes") aggr.job.num_nodes = jd.get("num_nodes")
aggr.job.exit_code = jd.get("exit_code")
allocated_nodes = [] allocated_nodes = []
aggr.job.alloc_cu = [] aggr.job.alloc_cu = []
......
...@@ -111,6 +111,9 @@ metrics_job = { ...@@ -111,6 +111,9 @@ metrics_job = {
"num_nodes": { "num_nodes": {
"dbname": "num_nodes", "dbname": "num_nodes",
"type": MType.INT}, "type": MType.INT},
"exit_code": {
"dbname": "exit_code",
"type": MType.INT},
"alloc_cu": { "alloc_cu": {
"dbname": "alloc_cu", "dbname": "alloc_cu",
"type": MType.STR}, "type": MType.STR},
......
...@@ -14,6 +14,7 @@ class OutputSchemes: ...@@ -14,6 +14,7 @@ class OutputSchemes:
"requested_time": "job.requested_time", "requested_time": "job.requested_time",
"requested_cu": "job.requested_cu", "requested_cu": "job.requested_cu",
"num_nodes": "job.num_nodes", "num_nodes": "job.num_nodes",
"exit_code": "job.exit_code",
}, },
"nodes": { "nodes": {
"type": "list", "type": "list",
...@@ -82,6 +83,7 @@ class OutputSchemes: ...@@ -82,6 +83,7 @@ class OutputSchemes:
"requested_time": "job.requested_time", "requested_time": "job.requested_time",
"requested_cu": "job.requested_cu", "requested_cu": "job.requested_cu",
"num_nodes": "job.num_nodes", "num_nodes": "job.num_nodes",
"exit_code": "job.exit_code",
}, },
"nodes": { "nodes": {
"type": "list", "type": "list",
......
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