feat: realtime log sync
This commit is contained in:
parent
3d099f88ea
commit
e692beb009
@ -971,6 +971,7 @@ async def send_json_override(self, event, data, sid=None):
|
|||||||
"data": data
|
"data": data
|
||||||
})
|
})
|
||||||
|
|
||||||
|
asyncio.create_task(update_run_ws_event(prompt_id, event, data))
|
||||||
# event_emitter.emit("send_json", {
|
# event_emitter.emit("send_json", {
|
||||||
# "event": event,
|
# "event": event,
|
||||||
# "data": data
|
# "data": data
|
||||||
@ -1094,6 +1095,26 @@ async def update_run_live_status(prompt_id, live_status, calculated_progress: fl
|
|||||||
# requests.post(status_endpoint, json=body)
|
# requests.post(status_endpoint, json=body)
|
||||||
await async_request_with_retry('POST', status_endpoint, token=token, json=body)
|
await async_request_with_retry('POST', status_endpoint, token=token, json=body)
|
||||||
|
|
||||||
|
async def update_run_ws_event(prompt_id: str, event: str, data: dict):
|
||||||
|
if prompt_id not in prompt_metadata:
|
||||||
|
return
|
||||||
|
|
||||||
|
# print("update_run_ws_event", prompt_id, event, data)
|
||||||
|
status_endpoint = prompt_metadata[prompt_id].status_endpoint
|
||||||
|
|
||||||
|
if status_endpoint is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
token = prompt_metadata[prompt_id].token
|
||||||
|
body = {
|
||||||
|
"run_id": prompt_id,
|
||||||
|
"ws_event": {
|
||||||
|
"event": event,
|
||||||
|
"data": data,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
await async_request_with_retry('POST', status_endpoint, token=token, json=body)
|
||||||
|
|
||||||
|
|
||||||
async def update_run(prompt_id: str, status: Status):
|
async def update_run(prompt_id: str, status: Status):
|
||||||
global last_read_line_number
|
global last_read_line_number
|
||||||
|
Loading…
x
Reference in New Issue
Block a user