Skip to content
Snippets Groups Projects
Commit 45bb3f0f authored by Michelle Weidling's avatar Michelle Weidling :blowfish:
Browse files

fix: return dict

parent 129163c2
No related branches found
No related tags found
No related merge requests found
Pipeline #509106 passed
......@@ -17,7 +17,7 @@ def remove_mongodb_id_from_result(json_data, result_type) -> list:
purged_list.append(d)
return purged_list
def remove_key_from_dict(d: dict, tbr_key: str) -> None:
def remove_key_from_dict(d: dict, tbr_key: str) -> dict:
"""
This function removes keys with the value of null from the result.
"""
......@@ -27,3 +27,4 @@ def remove_key_from_dict(d: dict, tbr_key: str) -> None:
del d[key]
else:
remove_key_from_dict(d[key], tbr_key)
return d
......@@ -124,7 +124,6 @@ def get_latest_runs(coll: collection.Collection,
{'metadata.ocr_workflow.id': wf_regex},
{'metadata.timestamp': compile(closest_timestamp)}]})
latest_run_json = json.loads(json_util.dumps(latest_run))
print(latest_run_json)
purged = remove_key_from_dict(latest_run_json, 'cpu_time')
return remove_mongodb_id_from_result(purged, 'run')
......@@ -146,7 +145,8 @@ def get_latest_runs_per_gt(coll: collection.Collection,
latest_run = coll.find({'$and': [{'metadata.gt_workspace.id': gt_regex},
{'metadata.timestamp': compile(closest_timestamp)}]})
latest_run_json = json.loads(json_util.dumps(latest_run))
return remove_mongodb_id_from_result(latest_run_json, 'run')
purged = remove_key_from_dict(latest_run_json, 'cpu_time')
return remove_mongodb_id_from_result(purged, 'run')
def post_new_result(coll: collection.Collection,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment