Image Pipeline Playground
feat(backend/engine): record per-node execution duration
Mohammad Rajaei47d60424924e
diff --git a/backend/app/engine/executor.py b/backend/app/engine/executor.pyindex d3bf3db..35b3d2b 100644--- a/backend/app/engine/executor.py+++ b/backend/app/engine/executor.py@@ -4,6 +4,7 @@ from __future__ import annotationsimport base64import threading+import timefrom collections import defaultdict, dequefrom collections.abc import Callablefrom pathlib import Path@@ -278,6 +279,7 @@ class DagExecutor:cache_hit = Falseproduced: dict[str, np.ndarray | list[np.ndarray]]+ started = time.perf_counter()if request.cache and self.cache.has_outputs(cache_key):cached = self.cache.get_outputs(cache_key)if cached is not None:@@ -295,6 +297,22 @@ class DagExecutor:meta={"node_id": node_id, "type": instance.type},)+ duration_ms = (time.perf_counter() - started) * 1000.0+ emit(+ ExecutionEvent(+ type=ExecutionEventType.PROGRESS,+ node_id=node_id,+ progress=(index + 1) / len(order),+ sample_index=sample_index,+ cache_hit=cache_hit,+ duration_ms=duration_ms,+ message=(+ f"Finished {instance.type} in {duration_ms:.1f}ms"+ + (" (cache)" if cache_hit else "")+ ),+ )+ )+_emit_port_previews(emit=emit,node_id=node_id,