Skip to content

Commit

Permalink
REST API: get_execution_livelog (mongoDB-only)
Browse files Browse the repository at this point in the history
  • Loading branch information
eudoxos committed Sep 26, 2023
1 parent d8abccb commit 6e44c7c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mupifDB/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ def get_execution_outputs(uid: str):
return inp.get('DataSet', None)
return None

@app.get("/executions/{uid}/livelog/{num}", tags=["Executions"])
def get_execution_livelog(uid: str, num: int):
if (rec:=db.WorkflowExecutions.find_one({"_id": bson.objectid.ObjectId(uid)})) and (uri:=rec.get('loggerURI',None)):
proxy=Pyro5.api.Proxy(uri)
proxy._pyroTimeout=5
ll=proxy.tail(num,raw=True)
if isinstance(ll,dict): ll=serpent.tobytes(ll)
ll=pickle.loads(ll)
return [fmt.format(rec) for rec in ll]


def get_execution_io_item(uid, name, obj_id, inout):
we = db.WorkflowExecutions.find_one({"_id": bson.objectid.ObjectId(uid)})
Expand Down

0 comments on commit 6e44c7c

Please sign in to comment.