add heavy loggin
This commit is contained in:
@@ -168,7 +168,7 @@ def run_pipeline(req: RunRequest):
|
||||
from detect.state import DetectState
|
||||
|
||||
local_path = _resolve_video_path(req.video_path)
|
||||
job_id = str(uuid.uuid4())[:8]
|
||||
job_id = str(uuid.uuid4())
|
||||
|
||||
if req.skip_vlm:
|
||||
os.environ["SKIP_VLM"] = "1"
|
||||
@@ -200,8 +200,6 @@ def run_pipeline(req: RunRequest):
|
||||
source_asset_id=req.source_asset_id,
|
||||
)
|
||||
|
||||
import traceback
|
||||
|
||||
from detect.graph import PipelineCancelled, set_cancel_check, clear_cancel_check
|
||||
|
||||
set_cancel_check(job_id, lambda: job_id in _cancelled_jobs)
|
||||
@@ -218,9 +216,17 @@ def run_pipeline(req: RunRequest):
|
||||
emit.job_complete(job_id, {"status": "cancelled"})
|
||||
except Exception as e:
|
||||
logger.exception("Pipeline run %s failed: %s", job_id, e)
|
||||
tb = traceback.format_exc()
|
||||
# Mark the current/last stage as error in the graph
|
||||
from detect.graph import _node_states, NODES
|
||||
if job_id in _node_states:
|
||||
states = _node_states[job_id]
|
||||
for node in reversed(NODES):
|
||||
if states.get(node) in ("running", "done"):
|
||||
states[node] = "error"
|
||||
break
|
||||
nodes = [{"id": n, "status": states[n]} for n in NODES]
|
||||
emit.graph_update(job_id, nodes)
|
||||
emit.log(job_id, "Pipeline", "ERROR", str(e))
|
||||
emit.log(job_id, "Pipeline", "DEBUG", tb)
|
||||
emit.job_complete(job_id, {"status": "failed", "error": str(e)})
|
||||
finally:
|
||||
_running_jobs.pop(job_id, None)
|
||||
|
||||
Reference in New Issue
Block a user