comfyui-node 1.6.3 → 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 +2 -2
- package/dist/index.d.ts.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 +1 -1
- package/dist/multipool/client-registry.js.map +1 -1
- package/dist/multipool/interfaces.d.ts +106 -0
- package/dist/multipool/interfaces.d.ts.map +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.map +1 -1
- package/dist/multipool/multi-workflow-pool.d.ts +2 -3
- package/dist/multipool/multi-workflow-pool.d.ts.map +1 -1
- 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/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
package/README.md
CHANGED
|
@@ -136,6 +136,56 @@ Hash-based routing intelligently handles failures at the workflow level (not cli
|
|
|
136
136
|
|
|
137
137
|
See [Hash-Based Routing Guide](./docs/hash-routing-guide.md) for details and demos.
|
|
138
138
|
|
|
139
|
+
### Advanced: `MultiWorkflowPool` for Heterogeneous Clusters
|
|
140
|
+
|
|
141
|
+
For complex use cases involving a heterogeneous cluster of workers (e.g., some with SDXL models, others for video generation), `MultiWorkflowPool` provides fine-grained control over job routing based on workflow requirements.
|
|
142
|
+
|
|
143
|
+
It uses an event-driven architecture to manage clients with specific **workflow affinities**, ensuring that jobs are only sent to nodes capable of processing them.
|
|
144
|
+
|
|
145
|
+
- **Workflow Affinity:** Assign clients to specific workflows. Jobs are automatically routed to the correct client.
|
|
146
|
+
- **Dynamic Job Queues:** A separate job queue is created for each workflow type, preventing head-of-line blocking.
|
|
147
|
+
- **Event-Driven Architecture:** Zero polling for maximum efficiency and responsiveness.
|
|
148
|
+
- **Built-in Monitoring:** Optional real-time monitoring of client and queue states.
|
|
149
|
+
|
|
150
|
+
**Example:**
|
|
151
|
+
```ts
|
|
152
|
+
import { MultiWorkflowPool, Workflow } from "comfyui-node";
|
|
153
|
+
import SdxlWorkflow from './sdxl-workflow.json';
|
|
154
|
+
import VideoWorkflow from './video-workflow.json';
|
|
155
|
+
|
|
156
|
+
// 1. Define workflows and generate their hash for affinity mapping
|
|
157
|
+
const sdxlWF = Workflow.from(SdxlWorkflow).updateHash();
|
|
158
|
+
const videoWF = Workflow.from(VideoWorkflow).updateHash();
|
|
159
|
+
|
|
160
|
+
// 2. Create a new pool
|
|
161
|
+
const pool = new MultiWorkflowPool({
|
|
162
|
+
logLevel: "info",
|
|
163
|
+
enableMonitoring: true,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// 3. Add clients with workflow affinity
|
|
167
|
+
// This client is specialized for SDXL workflows
|
|
168
|
+
pool.addClient("http://localhost:8188", { workflowAffinity: [sdxlWF] });
|
|
169
|
+
|
|
170
|
+
// This client is specialized for Video workflows
|
|
171
|
+
pool.addClient("http://localhost:8189", { workflowAffinity: [videoWF] });
|
|
172
|
+
|
|
173
|
+
// This client is a general-purpose worker
|
|
174
|
+
pool.addClient("http://localhost:8190");
|
|
175
|
+
|
|
176
|
+
// 4. Initialize the pool (connects to all clients)
|
|
177
|
+
await pool.init();
|
|
178
|
+
|
|
179
|
+
// 5. Submit jobs
|
|
180
|
+
// The pool automatically routes them to the correct client
|
|
181
|
+
const sdxlJobId = await pool.submitJob(sdxlWF);
|
|
182
|
+
const videoJobId = await pool.submitJob(videoWF);
|
|
183
|
+
|
|
184
|
+
// 6. Wait for a job to complete
|
|
185
|
+
const results = await pool.waitForJobCompletion(sdxlJobId);
|
|
186
|
+
console.log("SDXL Job completed!", results.images);
|
|
187
|
+
```
|
|
188
|
+
|
|
139
189
|
## What's New in v1.5.0
|
|
140
190
|
|
|
141
191
|
- **WorkflowPool Profiling** – Enable automatic per-node performance tracking with `enableProfiling: true`.
|