comfyui-node 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +18 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/multipool/client-registry.d.ts +23 -32
- package/dist/multipool/client-registry.d.ts.map +1 -1
- package/dist/multipool/client-registry.js +152 -152
- package/dist/multipool/client-registry.js.map +1 -1
- package/dist/multipool/helpers.js +52 -52
- package/dist/multipool/helpers.js.map +1 -1
- package/dist/multipool/index.js +2 -2
- package/dist/multipool/interfaces.d.ts +135 -12
- package/dist/multipool/interfaces.d.ts.map +1 -1
- package/dist/multipool/interfaces.js +1 -1
- package/dist/multipool/job-profiler.d.ts +64 -127
- package/dist/multipool/job-profiler.d.ts.map +1 -1
- package/dist/multipool/job-profiler.js +221 -221
- package/dist/multipool/job-profiler.js.map +1 -1
- package/dist/multipool/job-queue-processor.d.ts +23 -27
- package/dist/multipool/job-queue-processor.d.ts.map +1 -1
- package/dist/multipool/job-queue-processor.js +196 -196
- package/dist/multipool/job-queue-processor.js.map +1 -1
- package/dist/multipool/job-state-registry.d.ts +42 -66
- package/dist/multipool/job-state-registry.d.ts.map +1 -1
- package/dist/multipool/job-state-registry.js +282 -282
- package/dist/multipool/job-state-registry.js.map +1 -1
- package/dist/multipool/multi-workflow-pool.d.ts +101 -42
- package/dist/multipool/multi-workflow-pool.d.ts.map +1 -1
- package/dist/multipool/multi-workflow-pool.js +424 -313
- package/dist/multipool/multi-workflow-pool.js.map +1 -1
- package/dist/multipool/pool-event-manager.d.ts +10 -10
- package/dist/multipool/pool-event-manager.d.ts.map +1 -1
- package/dist/multipool/pool-event-manager.js +27 -27
- package/dist/multipool/tests/client-registry-api-demo.d.ts +7 -0
- package/dist/multipool/tests/client-registry-api-demo.d.ts.map +1 -0
- package/dist/multipool/tests/client-registry-api-demo.js +136 -0
- package/dist/multipool/tests/client-registry-api-demo.js.map +1 -0
- package/dist/multipool/tests/client-registry.spec.d.ts +2 -0
- package/dist/multipool/tests/client-registry.spec.d.ts.map +1 -0
- package/dist/multipool/tests/client-registry.spec.js +191 -0
- package/dist/multipool/tests/client-registry.spec.js.map +1 -0
- package/dist/multipool/tests/error-classification-tests.js +373 -373
- package/dist/multipool/tests/event-forwarding-demo.d.ts +7 -0
- package/dist/multipool/tests/event-forwarding-demo.d.ts.map +1 -0
- package/dist/multipool/tests/event-forwarding-demo.js +88 -0
- package/dist/multipool/tests/event-forwarding-demo.js.map +1 -0
- package/dist/multipool/tests/helpers.spec.d.ts +2 -0
- package/dist/multipool/tests/helpers.spec.d.ts.map +1 -0
- package/dist/multipool/tests/helpers.spec.js +100 -0
- package/dist/multipool/tests/helpers.spec.js.map +1 -0
- package/dist/multipool/tests/job-queue-processor.spec.d.ts +2 -0
- package/dist/multipool/tests/job-queue-processor.spec.d.ts.map +1 -0
- package/dist/multipool/tests/job-queue-processor.spec.js +89 -0
- package/dist/multipool/tests/job-queue-processor.spec.js.map +1 -0
- package/dist/multipool/tests/job-state-registry.spec.d.ts +2 -0
- package/dist/multipool/tests/job-state-registry.spec.d.ts.map +1 -0
- package/dist/multipool/tests/job-state-registry.spec.js +143 -0
- package/dist/multipool/tests/job-state-registry.spec.js.map +1 -0
- package/dist/multipool/tests/multipool-basic.js +141 -141
- package/dist/multipool/tests/profiling-demo.js +87 -87
- package/dist/multipool/tests/profiling-demo.js.map +1 -1
- package/dist/multipool/tests/two-stage-edit-simulation.js +298 -298
- package/dist/multipool/tests/two-stage-edit-simulation.js.map +1 -1
- package/dist/multipool/workflow.d.ts +178 -178
- package/dist/multipool/workflow.d.ts.map +1 -1
- package/dist/multipool/workflow.js +333 -333
- package/package.json +1 -1
|
@@ -1,222 +1,222 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Job Profiler for MultiWorkflowPool - Automatic per-node execution profiling
|
|
3
|
-
* ===========================================================================
|
|
4
|
-
*
|
|
5
|
-
* Captures detailed execution metrics for workflow jobs automatically:
|
|
6
|
-
* - Per-node execution timing
|
|
7
|
-
* - Progress tracking for nodes that emit progress events
|
|
8
|
-
* - Execution order and dependencies
|
|
9
|
-
* - Node types and metadata
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* ```ts
|
|
13
|
-
* const pool = new MultiWorkflowPool({ enableProfiling: true });
|
|
14
|
-
* const jobId = await pool.submitJob(workflow);
|
|
15
|
-
*
|
|
16
|
-
* const results = await pool.waitForJobCompletion(jobId);
|
|
17
|
-
* console.log(results.profileStats);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* JobProfiler tracks execution metrics for a single workflow job.
|
|
22
|
-
*/
|
|
23
|
-
export class JobProfiler {
|
|
24
|
-
queuedAt;
|
|
25
|
-
startedAt;
|
|
26
|
-
completedAt;
|
|
27
|
-
promptId;
|
|
28
|
-
nodeProfiles = new Map();
|
|
29
|
-
lastExecutingNode = null;
|
|
30
|
-
constructor(queuedAt, workflowJson) {
|
|
31
|
-
this.queuedAt = queuedAt;
|
|
32
|
-
// Initialize node profiles from workflow structure
|
|
33
|
-
if (workflowJson) {
|
|
34
|
-
for (const [nodeId, nodeData] of Object.entries(workflowJson)) {
|
|
35
|
-
const node = nodeData;
|
|
36
|
-
if (node && typeof node === 'object' && node.class_type) {
|
|
37
|
-
this.nodeProfiles.set(nodeId, {
|
|
38
|
-
nodeId,
|
|
39
|
-
type: node.class_type,
|
|
40
|
-
title: node._meta?.title,
|
|
41
|
-
cached: false,
|
|
42
|
-
status: 'pending'
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Record execution start event
|
|
50
|
-
*/
|
|
51
|
-
onExecutionStart(promptId) {
|
|
52
|
-
this.promptId = promptId;
|
|
53
|
-
if (!this.startedAt) {
|
|
54
|
-
this.startedAt = Date.now();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Record cached nodes
|
|
59
|
-
*/
|
|
60
|
-
onCachedNodes(nodeIds) {
|
|
61
|
-
const now = Date.now();
|
|
62
|
-
for (const nodeId of nodeIds) {
|
|
63
|
-
let profile = this.nodeProfiles.get(nodeId);
|
|
64
|
-
if (!profile) {
|
|
65
|
-
profile = {
|
|
66
|
-
nodeId,
|
|
67
|
-
cached: true,
|
|
68
|
-
status: 'cached'
|
|
69
|
-
};
|
|
70
|
-
this.nodeProfiles.set(nodeId, profile);
|
|
71
|
-
}
|
|
72
|
-
profile.cached = true;
|
|
73
|
-
profile.status = 'cached';
|
|
74
|
-
profile.startedAt = now;
|
|
75
|
-
profile.completedAt = now;
|
|
76
|
-
profile.duration = 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Record node execution start
|
|
81
|
-
*/
|
|
82
|
-
onNodeExecuting(nodeId) {
|
|
83
|
-
// Complete previous node if any
|
|
84
|
-
if (this.lastExecutingNode && this.lastExecutingNode !== nodeId) {
|
|
85
|
-
this.completeNode(this.lastExecutingNode);
|
|
86
|
-
}
|
|
87
|
-
// Start tracking new node
|
|
88
|
-
let profile = this.nodeProfiles.get(nodeId);
|
|
89
|
-
if (!profile) {
|
|
90
|
-
profile = {
|
|
91
|
-
nodeId,
|
|
92
|
-
cached: false,
|
|
93
|
-
status: 'executing'
|
|
94
|
-
};
|
|
95
|
-
this.nodeProfiles.set(nodeId, profile);
|
|
96
|
-
}
|
|
97
|
-
if (!profile.startedAt) {
|
|
98
|
-
profile.startedAt = Date.now();
|
|
99
|
-
profile.status = 'executing';
|
|
100
|
-
}
|
|
101
|
-
this.lastExecutingNode = nodeId;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Record node completion (when next node starts or execution ends)
|
|
105
|
-
*/
|
|
106
|
-
completeNode(nodeId) {
|
|
107
|
-
const profile = this.nodeProfiles.get(nodeId);
|
|
108
|
-
if (profile && !profile.completedAt && profile.startedAt) {
|
|
109
|
-
profile.completedAt = Date.now();
|
|
110
|
-
profile.duration = profile.completedAt - profile.startedAt;
|
|
111
|
-
profile.status = 'completed';
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Record execution end (node: null event)
|
|
116
|
-
*/
|
|
117
|
-
onExecutionComplete() {
|
|
118
|
-
// Complete last executing node
|
|
119
|
-
if (this.lastExecutingNode) {
|
|
120
|
-
this.completeNode(this.lastExecutingNode);
|
|
121
|
-
this.lastExecutingNode = null;
|
|
122
|
-
}
|
|
123
|
-
// Mark any nodes still in "executing" state as completed
|
|
124
|
-
for (const profile of Array.from(this.nodeProfiles.values())) {
|
|
125
|
-
if (profile.status === 'executing' && !profile.completedAt && profile.startedAt) {
|
|
126
|
-
profile.completedAt = Date.now();
|
|
127
|
-
profile.duration = profile.completedAt - profile.startedAt;
|
|
128
|
-
profile.status = 'completed';
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
this.completedAt = Date.now();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Record progress event for a node
|
|
135
|
-
*/
|
|
136
|
-
onProgress(nodeId, value, max) {
|
|
137
|
-
const nodeIdStr = String(nodeId);
|
|
138
|
-
let profile = this.nodeProfiles.get(nodeIdStr);
|
|
139
|
-
if (!profile) {
|
|
140
|
-
profile = {
|
|
141
|
-
nodeId: nodeIdStr,
|
|
142
|
-
cached: false,
|
|
143
|
-
status: 'executing',
|
|
144
|
-
progressEvents: []
|
|
145
|
-
};
|
|
146
|
-
this.nodeProfiles.set(nodeIdStr, profile);
|
|
147
|
-
}
|
|
148
|
-
if (!profile.progressEvents) {
|
|
149
|
-
profile.progressEvents = [];
|
|
150
|
-
}
|
|
151
|
-
profile.progressEvents.push({
|
|
152
|
-
timestamp: Date.now(),
|
|
153
|
-
value,
|
|
154
|
-
max
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Record node execution error
|
|
159
|
-
*/
|
|
160
|
-
onNodeError(nodeId, error) {
|
|
161
|
-
let profile = this.nodeProfiles.get(nodeId);
|
|
162
|
-
if (!profile) {
|
|
163
|
-
profile = {
|
|
164
|
-
nodeId,
|
|
165
|
-
cached: false,
|
|
166
|
-
status: 'failed'
|
|
167
|
-
};
|
|
168
|
-
this.nodeProfiles.set(nodeId, profile);
|
|
169
|
-
}
|
|
170
|
-
profile.status = 'failed';
|
|
171
|
-
profile.error = error;
|
|
172
|
-
profile.completedAt = Date.now();
|
|
173
|
-
if (profile.startedAt) {
|
|
174
|
-
profile.duration = profile.completedAt - profile.startedAt;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Generate final profile statistics
|
|
179
|
-
*/
|
|
180
|
-
getStats() {
|
|
181
|
-
const now = Date.now();
|
|
182
|
-
const completedAt = this.completedAt || now;
|
|
183
|
-
const startedAt = this.startedAt || this.queuedAt;
|
|
184
|
-
const nodes = Array.from(this.nodeProfiles.values());
|
|
185
|
-
// Calculate summary statistics
|
|
186
|
-
const executedNodes = nodes.filter(n => n.status === 'completed').length;
|
|
187
|
-
const cachedNodes = nodes.filter(n => n.cached).length;
|
|
188
|
-
const failedNodes = nodes.filter(n => n.status === 'failed').length;
|
|
189
|
-
const slowestNodes = nodes
|
|
190
|
-
.filter(n => n.duration && n.duration > 0)
|
|
191
|
-
.sort((a, b) => (b.duration || 0) - (a.duration || 0))
|
|
192
|
-
.slice(0, 5)
|
|
193
|
-
.map(n => ({
|
|
194
|
-
nodeId: n.nodeId,
|
|
195
|
-
type: n.type,
|
|
196
|
-
title: n.title,
|
|
197
|
-
duration: n.duration
|
|
198
|
-
}));
|
|
199
|
-
const progressNodes = nodes
|
|
200
|
-
.filter(n => n.progressEvents && n.progressEvents.length > 0)
|
|
201
|
-
.map(n => n.nodeId);
|
|
202
|
-
return {
|
|
203
|
-
promptId: this.promptId,
|
|
204
|
-
totalDuration: completedAt - this.queuedAt,
|
|
205
|
-
queueTime: startedAt - this.queuedAt,
|
|
206
|
-
executionTime: completedAt - startedAt,
|
|
207
|
-
queuedAt: this.queuedAt,
|
|
208
|
-
startedAt: this.startedAt,
|
|
209
|
-
completedAt,
|
|
210
|
-
nodes,
|
|
211
|
-
summary: {
|
|
212
|
-
totalNodes: nodes.length,
|
|
213
|
-
executedNodes,
|
|
214
|
-
cachedNodes,
|
|
215
|
-
failedNodes,
|
|
216
|
-
slowestNodes,
|
|
217
|
-
progressNodes
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Job Profiler for MultiWorkflowPool - Automatic per-node execution profiling
|
|
3
|
+
* ===========================================================================
|
|
4
|
+
*
|
|
5
|
+
* Captures detailed execution metrics for workflow jobs automatically:
|
|
6
|
+
* - Per-node execution timing
|
|
7
|
+
* - Progress tracking for nodes that emit progress events
|
|
8
|
+
* - Execution order and dependencies
|
|
9
|
+
* - Node types and metadata
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```ts
|
|
13
|
+
* const pool = new MultiWorkflowPool({ enableProfiling: true });
|
|
14
|
+
* const jobId = await pool.submitJob(workflow);
|
|
15
|
+
*
|
|
16
|
+
* const results = await pool.waitForJobCompletion(jobId);
|
|
17
|
+
* console.log(results.profileStats);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* JobProfiler tracks execution metrics for a single workflow job.
|
|
22
|
+
*/
|
|
23
|
+
export class JobProfiler {
|
|
24
|
+
queuedAt;
|
|
25
|
+
startedAt;
|
|
26
|
+
completedAt;
|
|
27
|
+
promptId;
|
|
28
|
+
nodeProfiles = new Map();
|
|
29
|
+
lastExecutingNode = null;
|
|
30
|
+
constructor(queuedAt, workflowJson) {
|
|
31
|
+
this.queuedAt = queuedAt;
|
|
32
|
+
// Initialize node profiles from workflow structure
|
|
33
|
+
if (workflowJson) {
|
|
34
|
+
for (const [nodeId, nodeData] of Object.entries(workflowJson)) {
|
|
35
|
+
const node = nodeData;
|
|
36
|
+
if (node && typeof node === 'object' && node.class_type) {
|
|
37
|
+
this.nodeProfiles.set(nodeId, {
|
|
38
|
+
nodeId,
|
|
39
|
+
type: node.class_type,
|
|
40
|
+
title: node._meta?.title,
|
|
41
|
+
cached: false,
|
|
42
|
+
status: 'pending'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Record execution start event
|
|
50
|
+
*/
|
|
51
|
+
onExecutionStart(promptId) {
|
|
52
|
+
this.promptId = promptId;
|
|
53
|
+
if (!this.startedAt) {
|
|
54
|
+
this.startedAt = Date.now();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Record cached nodes
|
|
59
|
+
*/
|
|
60
|
+
onCachedNodes(nodeIds) {
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
for (const nodeId of nodeIds) {
|
|
63
|
+
let profile = this.nodeProfiles.get(nodeId);
|
|
64
|
+
if (!profile) {
|
|
65
|
+
profile = {
|
|
66
|
+
nodeId,
|
|
67
|
+
cached: true,
|
|
68
|
+
status: 'cached'
|
|
69
|
+
};
|
|
70
|
+
this.nodeProfiles.set(nodeId, profile);
|
|
71
|
+
}
|
|
72
|
+
profile.cached = true;
|
|
73
|
+
profile.status = 'cached';
|
|
74
|
+
profile.startedAt = now;
|
|
75
|
+
profile.completedAt = now;
|
|
76
|
+
profile.duration = 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Record node execution start
|
|
81
|
+
*/
|
|
82
|
+
onNodeExecuting(nodeId) {
|
|
83
|
+
// Complete previous node if any
|
|
84
|
+
if (this.lastExecutingNode && this.lastExecutingNode !== nodeId) {
|
|
85
|
+
this.completeNode(this.lastExecutingNode);
|
|
86
|
+
}
|
|
87
|
+
// Start tracking new node
|
|
88
|
+
let profile = this.nodeProfiles.get(nodeId);
|
|
89
|
+
if (!profile) {
|
|
90
|
+
profile = {
|
|
91
|
+
nodeId,
|
|
92
|
+
cached: false,
|
|
93
|
+
status: 'executing'
|
|
94
|
+
};
|
|
95
|
+
this.nodeProfiles.set(nodeId, profile);
|
|
96
|
+
}
|
|
97
|
+
if (!profile.startedAt) {
|
|
98
|
+
profile.startedAt = Date.now();
|
|
99
|
+
profile.status = 'executing';
|
|
100
|
+
}
|
|
101
|
+
this.lastExecutingNode = nodeId;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Record node completion (when next node starts or execution ends)
|
|
105
|
+
*/
|
|
106
|
+
completeNode(nodeId) {
|
|
107
|
+
const profile = this.nodeProfiles.get(nodeId);
|
|
108
|
+
if (profile && !profile.completedAt && profile.startedAt) {
|
|
109
|
+
profile.completedAt = Date.now();
|
|
110
|
+
profile.duration = profile.completedAt - profile.startedAt;
|
|
111
|
+
profile.status = 'completed';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Record execution end (node: null event)
|
|
116
|
+
*/
|
|
117
|
+
onExecutionComplete() {
|
|
118
|
+
// Complete last executing node
|
|
119
|
+
if (this.lastExecutingNode) {
|
|
120
|
+
this.completeNode(this.lastExecutingNode);
|
|
121
|
+
this.lastExecutingNode = null;
|
|
122
|
+
}
|
|
123
|
+
// Mark any nodes still in "executing" state as completed
|
|
124
|
+
for (const profile of Array.from(this.nodeProfiles.values())) {
|
|
125
|
+
if (profile.status === 'executing' && !profile.completedAt && profile.startedAt) {
|
|
126
|
+
profile.completedAt = Date.now();
|
|
127
|
+
profile.duration = profile.completedAt - profile.startedAt;
|
|
128
|
+
profile.status = 'completed';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
this.completedAt = Date.now();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Record progress event for a node
|
|
135
|
+
*/
|
|
136
|
+
onProgress(nodeId, value, max) {
|
|
137
|
+
const nodeIdStr = String(nodeId);
|
|
138
|
+
let profile = this.nodeProfiles.get(nodeIdStr);
|
|
139
|
+
if (!profile) {
|
|
140
|
+
profile = {
|
|
141
|
+
nodeId: nodeIdStr,
|
|
142
|
+
cached: false,
|
|
143
|
+
status: 'executing',
|
|
144
|
+
progressEvents: []
|
|
145
|
+
};
|
|
146
|
+
this.nodeProfiles.set(nodeIdStr, profile);
|
|
147
|
+
}
|
|
148
|
+
if (!profile.progressEvents) {
|
|
149
|
+
profile.progressEvents = [];
|
|
150
|
+
}
|
|
151
|
+
profile.progressEvents.push({
|
|
152
|
+
timestamp: Date.now(),
|
|
153
|
+
value,
|
|
154
|
+
max
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Record node execution error
|
|
159
|
+
*/
|
|
160
|
+
onNodeError(nodeId, error) {
|
|
161
|
+
let profile = this.nodeProfiles.get(nodeId);
|
|
162
|
+
if (!profile) {
|
|
163
|
+
profile = {
|
|
164
|
+
nodeId,
|
|
165
|
+
cached: false,
|
|
166
|
+
status: 'failed'
|
|
167
|
+
};
|
|
168
|
+
this.nodeProfiles.set(nodeId, profile);
|
|
169
|
+
}
|
|
170
|
+
profile.status = 'failed';
|
|
171
|
+
profile.error = error;
|
|
172
|
+
profile.completedAt = Date.now();
|
|
173
|
+
if (profile.startedAt) {
|
|
174
|
+
profile.duration = profile.completedAt - profile.startedAt;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Generate final profile statistics
|
|
179
|
+
*/
|
|
180
|
+
getStats() {
|
|
181
|
+
const now = Date.now();
|
|
182
|
+
const completedAt = this.completedAt || now;
|
|
183
|
+
const startedAt = this.startedAt || this.queuedAt;
|
|
184
|
+
const nodes = Array.from(this.nodeProfiles.values());
|
|
185
|
+
// Calculate summary statistics
|
|
186
|
+
const executedNodes = nodes.filter(n => n.status === 'completed').length;
|
|
187
|
+
const cachedNodes = nodes.filter(n => n.cached).length;
|
|
188
|
+
const failedNodes = nodes.filter(n => n.status === 'failed').length;
|
|
189
|
+
const slowestNodes = nodes
|
|
190
|
+
.filter(n => n.duration && n.duration > 0)
|
|
191
|
+
.sort((a, b) => (b.duration || 0) - (a.duration || 0))
|
|
192
|
+
.slice(0, 5)
|
|
193
|
+
.map(n => ({
|
|
194
|
+
nodeId: n.nodeId,
|
|
195
|
+
type: n.type,
|
|
196
|
+
title: n.title,
|
|
197
|
+
duration: n.duration
|
|
198
|
+
}));
|
|
199
|
+
const progressNodes = nodes
|
|
200
|
+
.filter(n => n.progressEvents && n.progressEvents.length > 0)
|
|
201
|
+
.map(n => n.nodeId);
|
|
202
|
+
return {
|
|
203
|
+
promptId: this.promptId,
|
|
204
|
+
totalDuration: completedAt - this.queuedAt,
|
|
205
|
+
queueTime: startedAt - this.queuedAt,
|
|
206
|
+
executionTime: completedAt - startedAt,
|
|
207
|
+
queuedAt: this.queuedAt,
|
|
208
|
+
startedAt: this.startedAt,
|
|
209
|
+
completedAt,
|
|
210
|
+
nodes,
|
|
211
|
+
summary: {
|
|
212
|
+
totalNodes: nodes.length,
|
|
213
|
+
executedNodes,
|
|
214
|
+
cachedNodes,
|
|
215
|
+
failedNodes,
|
|
216
|
+
slowestNodes,
|
|
217
|
+
progressNodes
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
222
|
//# sourceMappingURL=job-profiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-profiler.js","sourceRoot":"","sources":["../../src/multipool/job-profiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"job-profiler.js","sourceRoot":"","sources":["../../src/multipool/job-profiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;GAEG;AACH,MAAM,O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CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;aAC5D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAEtB,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC,QAAQ;YAC1C,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC,QAAQ;YACpC,aAAa,EAAE,WAAW,GAAG,SAAS;YACtC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW;YACX,KAAK;YACL,OAAO,EAAE;gBACP,UAAU,EAAE,KAAK,CAAC,MAAM;gBACxB,aAAa;gBACb,WAAW;gBACX,WAAW;gBACX,YAAY;gBACZ,aAAa;aACd;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import { Workflow } from "./workflow.js";
|
|
2
|
-
import { JobStateRegistry } from "./job-state-registry.js";
|
|
3
|
-
import { ClientRegistry } from "./client-registry.js";
|
|
4
|
-
import { Logger } from "./logger.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
private handleFailure;
|
|
25
|
-
private retryOrMarkFailed;
|
|
26
|
-
private processAttachedMedia;
|
|
27
|
-
}
|
|
1
|
+
import { Workflow } from "./workflow.js";
|
|
2
|
+
import { JobStateRegistry } from "./job-state-registry.js";
|
|
3
|
+
import { ClientRegistry } from "./client-registry.js";
|
|
4
|
+
import { Logger } from "./logger.js";
|
|
5
|
+
import { QueueJob } from "./interfaces.js";
|
|
6
|
+
export declare class JobQueueProcessor {
|
|
7
|
+
private jobs;
|
|
8
|
+
private clientRegistry;
|
|
9
|
+
private logger;
|
|
10
|
+
queue: Array<QueueJob>;
|
|
11
|
+
workflowHash: string;
|
|
12
|
+
isProcessing: boolean;
|
|
13
|
+
maxAttempts: number;
|
|
14
|
+
constructor(stateRegistry: JobStateRegistry, clientRegistry: ClientRegistry, workflowHash: string, logger: Logger);
|
|
15
|
+
enqueueJob(newJobId: string, workflow: Workflow): Promise<void>;
|
|
16
|
+
processQueue(): Promise<void>;
|
|
17
|
+
private applyAutoSeed;
|
|
18
|
+
private runJobOnClient;
|
|
19
|
+
dequeueJob(jobId: string): void;
|
|
20
|
+
private handleFailure;
|
|
21
|
+
private retryOrMarkFailed;
|
|
22
|
+
private processAttachedMedia;
|
|
23
|
+
}
|
|
28
24
|
//# sourceMappingURL=job-queue-processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-queue-processor.d.ts","sourceRoot":"","sources":["../../src/multipool/job-queue-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"job-queue-processor.d.ts","sourceRoot":"","sources":["../../src/multipool/job-queue-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAkB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3D,qBAAa,iBAAiB;IAE5B,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,MAAM,CAAS;IACvB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAM;IAC5B,YAAY,EAAE,MAAM,CAAM;IAC1B,YAAY,EAAE,OAAO,CAAS;IAC9B,WAAW,EAAE,MAAM,CAAK;gBAEZ,aAAa,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAQ3G,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAY/C,YAAY;IAyDlB,OAAO,CAAC,aAAa;YAeP,cAAc;IAkD5B,UAAU,CAAC,KAAK,EAAE,MAAM;IAIxB,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,iBAAiB;YAuBX,oBAAoB;CAGnC"}
|