@workglow/task-graph 0.3.1 → 0.3.2
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/dist/browser.js +108 -80
- package/dist/browser.js.map +6 -6
- package/dist/bun.js +108 -80
- package/dist/bun.js.map +6 -6
- package/dist/node.js +108 -80
- package/dist/node.js.map +6 -6
- package/dist/task/ITask.d.ts +1 -4
- package/dist/task/ITask.d.ts.map +1 -1
- package/dist/task/JobQueueFactory.d.ts.map +1 -1
- package/dist/task/Task.d.ts +22 -10
- package/dist/task/Task.d.ts.map +1 -1
- package/dist/task/TaskRunContext.d.ts +7 -0
- package/dist/task/TaskRunContext.d.ts.map +1 -1
- package/dist/task/TaskRunner.d.ts +33 -14
- package/dist/task/TaskRunner.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/bun.js
CHANGED
|
@@ -1278,14 +1278,14 @@ import { EventEmitter as EventEmitter4, uuid4 as uuid45 } from "@workglow/util";
|
|
|
1278
1278
|
import { DirectedAcyclicGraph } from "@workglow/util/graph";
|
|
1279
1279
|
|
|
1280
1280
|
// src/task/GraphAsTask.ts
|
|
1281
|
-
import { getLogger as
|
|
1281
|
+
import { getLogger as getLogger6 } from "@workglow/util";
|
|
1282
1282
|
import { CycleError } from "@workglow/util/graph";
|
|
1283
1283
|
import { compileSchema as compileSchema2 } from "@workglow/util/schema";
|
|
1284
1284
|
|
|
1285
1285
|
// src/task-graph/TaskGraphRunner.ts
|
|
1286
1286
|
import {
|
|
1287
1287
|
collectPropertyValues,
|
|
1288
|
-
getLogger as
|
|
1288
|
+
getLogger as getLogger5,
|
|
1289
1289
|
getTelemetryProvider as getTelemetryProvider2,
|
|
1290
1290
|
globalServiceRegistry as globalServiceRegistry3,
|
|
1291
1291
|
ResourceScope as ResourceScope2,
|
|
@@ -1630,7 +1630,7 @@ function hasStructuredOutput(schema) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
|
|
1632
1632
|
// src/task/Task.ts
|
|
1633
|
-
import { deepEqual, EventEmitter as EventEmitter3,
|
|
1633
|
+
import { deepEqual, EventEmitter as EventEmitter3, uuid4 as uuid42 } from "@workglow/util";
|
|
1634
1634
|
import { compileSchema } from "@workglow/util/schema";
|
|
1635
1635
|
|
|
1636
1636
|
// src/task/TaskRunner.ts
|
|
@@ -1901,6 +1901,7 @@ class TaskRunContext {
|
|
|
1901
1901
|
telemetrySpan;
|
|
1902
1902
|
timeoutTimer;
|
|
1903
1903
|
pendingTimeoutError;
|
|
1904
|
+
terminated = false;
|
|
1904
1905
|
parentSignalCleanup;
|
|
1905
1906
|
constructor(parentSignal) {
|
|
1906
1907
|
this.abortController = new AbortController;
|
|
@@ -1955,9 +1956,9 @@ class TaskRunner {
|
|
|
1955
1956
|
const ownsScope = config.resourceScope === undefined;
|
|
1956
1957
|
const effectiveConfig = ownsScope ? { ...config, resourceScope: new ResourceScope({ strategy: config.disposeStrategy }) } : config;
|
|
1957
1958
|
this.ownsResourceScope = ownsScope;
|
|
1959
|
+
let ctx;
|
|
1958
1960
|
try {
|
|
1959
|
-
await this.handleStart(effectiveConfig);
|
|
1960
|
-
const ctx = this.currentCtx;
|
|
1961
|
+
ctx = await this.handleStart(effectiveConfig);
|
|
1961
1962
|
const proto = Object.getPrototypeOf(this.task);
|
|
1962
1963
|
if (proto.execute === Task.prototype.execute && typeof proto.executeStream !== "function" && proto.executePreview !== Task.prototype.executePreview) {
|
|
1963
1964
|
throw new TaskConfigurationError(`Task "${this.task.type}" implements only executePreview() and cannot be run via run(). ` + `After the run/runPreview split, run() requires execute() (or executeStream()). ` + `See docs/technical/02-dual-mode-execution.md.`);
|
|
@@ -1971,7 +1972,7 @@ class TaskRunner {
|
|
|
1971
1972
|
throw new TaskInvalidInputError("Invalid input data");
|
|
1972
1973
|
}
|
|
1973
1974
|
if (ctx.abortController.signal.aborted) {
|
|
1974
|
-
await this.handleAbort();
|
|
1975
|
+
await this.handleAbort(ctx);
|
|
1975
1976
|
throw new TaskAbortedError("Promise for task created and aborted before run");
|
|
1976
1977
|
}
|
|
1977
1978
|
const isStreamable = isTaskStreamable(this.task);
|
|
@@ -1990,7 +1991,7 @@ class TaskRunner {
|
|
|
1990
1991
|
}
|
|
1991
1992
|
policy = { kind: "none" };
|
|
1992
1993
|
}
|
|
1993
|
-
|
|
1994
|
+
ctx.telemetrySpan?.setAttributes({
|
|
1994
1995
|
"workglow.task.cache_policy": policy.kind
|
|
1995
1996
|
});
|
|
1996
1997
|
const keyInputs = await this.cacheCoordinator.buildKeyForPolicy(inputs, this.cacheRegistry, policy);
|
|
@@ -2006,12 +2007,30 @@ class TaskRunner {
|
|
|
2006
2007
|
await this.cacheCoordinator.saveByPolicy(keyInputs, outputs, this.cacheRegistry, policy);
|
|
2007
2008
|
this.task.runOutputData = outputs ?? {};
|
|
2008
2009
|
}
|
|
2009
|
-
await this.handleComplete();
|
|
2010
|
+
await this.handleComplete(ctx);
|
|
2010
2011
|
return this.task.runOutputData;
|
|
2011
2012
|
} catch (err) {
|
|
2012
|
-
await this.handleError(err);
|
|
2013
|
+
await this.handleError(err, ctx);
|
|
2013
2014
|
throw this.task.error instanceof TaskTimeoutError ? this.task.error : err;
|
|
2014
2015
|
}
|
|
2016
|
+
} catch (err) {
|
|
2017
|
+
if (ctx === undefined) {
|
|
2018
|
+
const partial = this.currentCtx;
|
|
2019
|
+
if (partial) {
|
|
2020
|
+
await this.handleError(err, partial);
|
|
2021
|
+
} else {
|
|
2022
|
+
this.task.status = TaskStatus.FAILED;
|
|
2023
|
+
this.task.error = err instanceof TaskError ? err : new TaskFailedError(`Task "${this.task.type}" (${this.task.id}): ${err?.message || "Task failed"}`);
|
|
2024
|
+
if (this.task.error instanceof TaskError) {
|
|
2025
|
+
this.task.error.taskType ??= this.task.type;
|
|
2026
|
+
this.task.error.taskId ??= this.task.id;
|
|
2027
|
+
}
|
|
2028
|
+
this.task.emit("error", this.task.error);
|
|
2029
|
+
this.task.emit("status", this.task.status);
|
|
2030
|
+
}
|
|
2031
|
+
this.running = false;
|
|
2032
|
+
}
|
|
2033
|
+
throw err;
|
|
2015
2034
|
} finally {
|
|
2016
2035
|
if (ownsScope) {
|
|
2017
2036
|
await effectiveConfig.resourceScope.runComplete();
|
|
@@ -2195,7 +2214,7 @@ class TaskRunner {
|
|
|
2195
2214
|
const ctx = new TaskRunContext(config.signal);
|
|
2196
2215
|
this.currentCtx = ctx;
|
|
2197
2216
|
ctx.abortController.signal.addEventListener("abort", () => {
|
|
2198
|
-
this.handleAbort();
|
|
2217
|
+
this.handleAbort(ctx);
|
|
2199
2218
|
});
|
|
2200
2219
|
if (config.registry) {
|
|
2201
2220
|
this.registry = config.registry;
|
|
@@ -2227,12 +2246,12 @@ class TaskRunner {
|
|
|
2227
2246
|
await this.resourceScope.runStart();
|
|
2228
2247
|
}
|
|
2229
2248
|
if (ctx.abortController.signal.aborted)
|
|
2230
|
-
return;
|
|
2249
|
+
return ctx;
|
|
2231
2250
|
const timeout = this.task.config.timeout;
|
|
2232
2251
|
if (timeout !== undefined && timeout > 0) {
|
|
2233
2252
|
ctx.pendingTimeoutError = new TaskTimeoutError(timeout);
|
|
2234
2253
|
ctx.timeoutTimer = setTimeout(() => {
|
|
2235
|
-
|
|
2254
|
+
ctx.abortController.abort();
|
|
2236
2255
|
}, timeout);
|
|
2237
2256
|
}
|
|
2238
2257
|
const telemetry = getTelemetryProvider();
|
|
@@ -2247,27 +2266,27 @@ class TaskRunner {
|
|
|
2247
2266
|
}
|
|
2248
2267
|
this.task.emit("start");
|
|
2249
2268
|
this.task.emit("status", this.task.status);
|
|
2269
|
+
return ctx;
|
|
2250
2270
|
}
|
|
2251
2271
|
updateProgress = async (_task, _progress, _message, ..._args) => {};
|
|
2252
2272
|
async handleStartPreview() {
|
|
2253
2273
|
this.previewRunning = true;
|
|
2254
2274
|
}
|
|
2255
|
-
clearTimeoutTimer() {
|
|
2256
|
-
|
|
2257
|
-
if (ctx?.timeoutTimer !== undefined) {
|
|
2275
|
+
clearTimeoutTimer(ctx) {
|
|
2276
|
+
if (ctx.timeoutTimer !== undefined) {
|
|
2258
2277
|
clearTimeout(ctx.timeoutTimer);
|
|
2259
2278
|
ctx.timeoutTimer = undefined;
|
|
2260
2279
|
}
|
|
2261
2280
|
}
|
|
2262
|
-
async handleAbort() {
|
|
2263
|
-
if (
|
|
2281
|
+
async handleAbort(ctx) {
|
|
2282
|
+
if (ctx.terminated)
|
|
2264
2283
|
return;
|
|
2265
|
-
|
|
2266
|
-
|
|
2284
|
+
ctx.terminated = true;
|
|
2285
|
+
this.clearTimeoutTimer(ctx);
|
|
2267
2286
|
this.task.status = TaskStatus.ABORTING;
|
|
2268
2287
|
await this.handleProgress(100);
|
|
2269
|
-
this.task.error = ctx
|
|
2270
|
-
if (ctx
|
|
2288
|
+
this.task.error = ctx.pendingTimeoutError ?? new TaskAbortedError;
|
|
2289
|
+
if (ctx.telemetrySpan) {
|
|
2271
2290
|
ctx.telemetrySpan.setStatus(SpanStatusCode.ERROR, "aborted");
|
|
2272
2291
|
ctx.telemetrySpan.addEvent("workglow.task.aborted", {
|
|
2273
2292
|
"workglow.task.error": this.task.error.message
|
|
@@ -2279,28 +2298,30 @@ class TaskRunner {
|
|
|
2279
2298
|
await this.task.cleanup();
|
|
2280
2299
|
} catch {}
|
|
2281
2300
|
}
|
|
2282
|
-
ctx
|
|
2283
|
-
this.currentCtx
|
|
2301
|
+
ctx.dispose();
|
|
2302
|
+
if (this.currentCtx === ctx)
|
|
2303
|
+
this.currentCtx = undefined;
|
|
2284
2304
|
this.task.emit("abort", this.task.error);
|
|
2285
2305
|
this.task.emit("status", this.task.status);
|
|
2286
2306
|
}
|
|
2287
2307
|
async handleAbortPreview() {
|
|
2288
2308
|
this.previewRunning = false;
|
|
2289
2309
|
}
|
|
2290
|
-
async handleComplete() {
|
|
2291
|
-
if (
|
|
2310
|
+
async handleComplete(ctx) {
|
|
2311
|
+
if (ctx.terminated)
|
|
2292
2312
|
return;
|
|
2293
|
-
|
|
2294
|
-
|
|
2313
|
+
ctx.terminated = true;
|
|
2314
|
+
this.clearTimeoutTimer(ctx);
|
|
2295
2315
|
this.task.completedAt = new Date;
|
|
2296
2316
|
this.task.status = TaskStatus.COMPLETED;
|
|
2297
2317
|
await this.handleProgress(100);
|
|
2298
|
-
if (ctx
|
|
2318
|
+
if (ctx.telemetrySpan) {
|
|
2299
2319
|
ctx.telemetrySpan.setStatus(SpanStatusCode.OK);
|
|
2300
2320
|
ctx.telemetrySpan.end();
|
|
2301
2321
|
}
|
|
2302
|
-
ctx
|
|
2303
|
-
this.currentCtx
|
|
2322
|
+
ctx.dispose();
|
|
2323
|
+
if (this.currentCtx === ctx)
|
|
2324
|
+
this.currentCtx = undefined;
|
|
2304
2325
|
this.task.emit("complete");
|
|
2305
2326
|
this.task.emit("status", this.task.status);
|
|
2306
2327
|
}
|
|
@@ -2308,8 +2329,10 @@ class TaskRunner {
|
|
|
2308
2329
|
this.previewRunning = false;
|
|
2309
2330
|
}
|
|
2310
2331
|
async handleDisable(ctx) {
|
|
2311
|
-
if (this.task.status === TaskStatus.DISABLED)
|
|
2332
|
+
if (ctx?.terminated || this.task.status === TaskStatus.DISABLED)
|
|
2312
2333
|
return;
|
|
2334
|
+
if (ctx)
|
|
2335
|
+
ctx.terminated = true;
|
|
2313
2336
|
this.task.status = TaskStatus.DISABLED;
|
|
2314
2337
|
await this.handleProgress(100);
|
|
2315
2338
|
this.task.completedAt = new Date;
|
|
@@ -2322,13 +2345,13 @@ class TaskRunner {
|
|
|
2322
2345
|
async disable() {
|
|
2323
2346
|
await this.handleDisable(this.currentCtx);
|
|
2324
2347
|
}
|
|
2325
|
-
async handleError(err) {
|
|
2348
|
+
async handleError(err, ctx) {
|
|
2326
2349
|
if (err instanceof TaskAbortedError)
|
|
2327
|
-
return this.handleAbort();
|
|
2328
|
-
if (
|
|
2350
|
+
return this.handleAbort(ctx);
|
|
2351
|
+
if (ctx.terminated)
|
|
2329
2352
|
return;
|
|
2330
|
-
|
|
2331
|
-
|
|
2353
|
+
ctx.terminated = true;
|
|
2354
|
+
this.clearTimeoutTimer(ctx);
|
|
2332
2355
|
if (this.task.hasChildren()) {
|
|
2333
2356
|
this.task.subGraph.abort();
|
|
2334
2357
|
}
|
|
@@ -2344,13 +2367,14 @@ class TaskRunner {
|
|
|
2344
2367
|
}
|
|
2345
2368
|
this.task.status = TaskStatus.FAILED;
|
|
2346
2369
|
await this.handleProgress(100);
|
|
2347
|
-
if (ctx
|
|
2370
|
+
if (ctx.telemetrySpan) {
|
|
2348
2371
|
ctx.telemetrySpan.setStatus(SpanStatusCode.ERROR, this.task.error.message);
|
|
2349
2372
|
ctx.telemetrySpan.setAttributes({ "workglow.task.error": this.task.error.message });
|
|
2350
2373
|
ctx.telemetrySpan.end();
|
|
2351
2374
|
}
|
|
2352
|
-
ctx
|
|
2353
|
-
this.currentCtx
|
|
2375
|
+
ctx.dispose();
|
|
2376
|
+
if (this.currentCtx === ctx)
|
|
2377
|
+
this.currentCtx = undefined;
|
|
2354
2378
|
this.task.emit("error", this.task.error);
|
|
2355
2379
|
this.task.emit("status", this.task.status);
|
|
2356
2380
|
}
|
|
@@ -2379,7 +2403,6 @@ class Task {
|
|
|
2379
2403
|
static isGraphOutput = false;
|
|
2380
2404
|
static isPassthrough = false;
|
|
2381
2405
|
static hasDynamicEntitlements = false;
|
|
2382
|
-
static __cacheableDeprecationWarned = new Set;
|
|
2383
2406
|
static entitlements() {
|
|
2384
2407
|
return EMPTY_ENTITLEMENTS;
|
|
2385
2408
|
}
|
|
@@ -2479,17 +2502,11 @@ class Task {
|
|
|
2479
2502
|
}
|
|
2480
2503
|
getCachePolicy(_inputs) {
|
|
2481
2504
|
const ctor = this.constructor;
|
|
2482
|
-
const hasLegacyOverride = Object.prototype.hasOwnProperty.call(ctor, "cacheable") && ctor.cacheable === false;
|
|
2483
|
-
const hasPolicyOverride = Object.prototype.hasOwnProperty.call(ctor, "cachePolicy");
|
|
2484
|
-
if (hasLegacyOverride && !hasPolicyOverride) {
|
|
2485
|
-
if (!Task.__cacheableDeprecationWarned.has(ctor.type)) {
|
|
2486
|
-
Task.__cacheableDeprecationWarned.add(ctor.type);
|
|
2487
|
-
getLogger2().warn(`Task "${ctor.type}": static \`cacheable = false\` is deprecated. ` + `Use \`static cachePolicy: CachePolicy = { kind: "none" }\` instead.`);
|
|
2488
|
-
}
|
|
2489
|
-
return { kind: "none" };
|
|
2490
|
-
}
|
|
2491
2505
|
if (this.runConfig?.cacheable === false || this.config?.cacheable === false)
|
|
2492
2506
|
return { kind: "none" };
|
|
2507
|
+
if (Object.prototype.hasOwnProperty.call(ctor, "cacheable") && ctor.cacheable === false && !Object.prototype.hasOwnProperty.call(ctor, "cachePolicy")) {
|
|
2508
|
+
return { kind: "none" };
|
|
2509
|
+
}
|
|
2493
2510
|
return ctor.cachePolicy ?? DEFAULT_CACHE_POLICY;
|
|
2494
2511
|
}
|
|
2495
2512
|
defaults;
|
|
@@ -2917,9 +2934,12 @@ class Task {
|
|
|
2917
2934
|
this.events.emit("regenerate");
|
|
2918
2935
|
}
|
|
2919
2936
|
}
|
|
2937
|
+
function __resetCacheableDeprecationWarnings() {
|
|
2938
|
+
Task.__cacheableDeprecationWarned.clear();
|
|
2939
|
+
}
|
|
2920
2940
|
|
|
2921
2941
|
// src/task-graph/EdgeMaterializer.ts
|
|
2922
|
-
import { getLogger as
|
|
2942
|
+
import { getLogger as getLogger2 } from "@workglow/util";
|
|
2923
2943
|
import { previewSource } from "@workglow/util/media";
|
|
2924
2944
|
class EdgeMaterializer {
|
|
2925
2945
|
graph;
|
|
@@ -2983,7 +3003,7 @@ class EdgeMaterializer {
|
|
|
2983
3003
|
} else {
|
|
2984
3004
|
const resultsKeys = Object.keys(results);
|
|
2985
3005
|
if (resultsKeys.length > 0) {
|
|
2986
|
-
|
|
3006
|
+
getLogger2().warn("pushOutputFromNodeToEdge not compatible, not setting port data", {
|
|
2987
3007
|
dataflowId: dataflow.id,
|
|
2988
3008
|
compatibility,
|
|
2989
3009
|
resultsKeys
|
|
@@ -3079,10 +3099,10 @@ class RunContext {
|
|
|
3079
3099
|
}
|
|
3080
3100
|
|
|
3081
3101
|
// src/task-graph/RunScheduler.ts
|
|
3082
|
-
import { getLogger as
|
|
3102
|
+
import { getLogger as getLogger4 } from "@workglow/util";
|
|
3083
3103
|
|
|
3084
3104
|
// src/task/ConditionalTask.ts
|
|
3085
|
-
import { getLogger as
|
|
3105
|
+
import { getLogger as getLogger3 } from "@workglow/util";
|
|
3086
3106
|
|
|
3087
3107
|
// src/task/ConditionUtils.ts
|
|
3088
3108
|
function evaluateCondition(fieldValue, operator, compareValue) {
|
|
@@ -3240,7 +3260,7 @@ class ConditionalTask extends Task {
|
|
|
3240
3260
|
}
|
|
3241
3261
|
}
|
|
3242
3262
|
} catch (error) {
|
|
3243
|
-
|
|
3263
|
+
getLogger3().error(`Condition evaluation failed for branch "${branch.id}":`, { error });
|
|
3244
3264
|
}
|
|
3245
3265
|
}
|
|
3246
3266
|
if (this.activeBranches.size === 0 && defaultBranch) {
|
|
@@ -3512,7 +3532,7 @@ class RunScheduler {
|
|
|
3512
3532
|
ctx.inProgressFunctions.set(Symbol(task.id), runAsync());
|
|
3513
3533
|
}
|
|
3514
3534
|
} catch (err) {
|
|
3515
|
-
|
|
3535
|
+
getLogger4().error("Error running graph", { error: err });
|
|
3516
3536
|
}
|
|
3517
3537
|
await Promise.allSettled(Array.from(ctx.inProgressTasks.values()));
|
|
3518
3538
|
await Promise.allSettled(Array.from(ctx.inProgressFunctions.values()));
|
|
@@ -3915,7 +3935,7 @@ class TaskGraphRunner {
|
|
|
3915
3935
|
try {
|
|
3916
3936
|
await runPrivateToClean.clearRun();
|
|
3917
3937
|
} catch (e) {
|
|
3918
|
-
|
|
3938
|
+
getLogger5().warn("RunPrivateCacheRepo.clearRun failed", { error: e });
|
|
3919
3939
|
}
|
|
3920
3940
|
}
|
|
3921
3941
|
return this.filterLeafResults(results);
|
|
@@ -3989,7 +4009,7 @@ class TaskGraphRunner {
|
|
|
3989
4009
|
});
|
|
3990
4010
|
previewSpan.setStatus(SpanStatusCode2.OK);
|
|
3991
4011
|
previewSpan.end();
|
|
3992
|
-
|
|
4012
|
+
getLogger5().debug("task graph runPreview timings", {
|
|
3993
4013
|
previewRunId,
|
|
3994
4014
|
totalMs: Math.round(totalMs * 1000) / 1000,
|
|
3995
4015
|
taskTimings
|
|
@@ -4007,7 +4027,7 @@ class TaskGraphRunner {
|
|
|
4007
4027
|
});
|
|
4008
4028
|
previewSpan.setStatus(SpanStatusCode2.ERROR, message);
|
|
4009
4029
|
previewSpan.end();
|
|
4010
|
-
|
|
4030
|
+
getLogger5().debug("task graph runPreview failed", {
|
|
4011
4031
|
previewRunId,
|
|
4012
4032
|
totalMs: Math.round(totalMs * 1000) / 1000,
|
|
4013
4033
|
taskTimings,
|
|
@@ -4140,7 +4160,7 @@ class TaskGraphRunner {
|
|
|
4140
4160
|
const repo = checkRegistry.private;
|
|
4141
4161
|
if (!TaskGraphRunner.__durabilityWarnedRepos.has(repo)) {
|
|
4142
4162
|
TaskGraphRunner.__durabilityWarnedRepos.add(repo);
|
|
4143
|
-
|
|
4163
|
+
getLogger5().warn("TaskGraphRunner: private cache repo may be used but is non-durable \u2014 " + "restart-survival will not work. Ensure the CacheRegistry 'private' " + "slot is backed by a durable storage backend.");
|
|
4144
4164
|
}
|
|
4145
4165
|
}
|
|
4146
4166
|
}
|
|
@@ -4455,7 +4475,7 @@ class GraphAsTask extends Task {
|
|
|
4455
4475
|
const schemaNode = Task.generateInputSchemaNode(dataPortSchema);
|
|
4456
4476
|
this._inputSchemaNode = schemaNode;
|
|
4457
4477
|
} catch (error) {
|
|
4458
|
-
|
|
4478
|
+
getLogger6().warn(`GraphAsTask "${this.type}" (${this.id}): Failed to compile input schema, ` + `falling back to permissive validation. Inputs will NOT be validated.`, { error, taskType: this.type, taskId: this.id });
|
|
4459
4479
|
this._inputSchemaNode = compileSchema2({});
|
|
4460
4480
|
}
|
|
4461
4481
|
}
|
|
@@ -5372,7 +5392,7 @@ function autoConnect(graph, sourceTask, targetTask, options) {
|
|
|
5372
5392
|
}
|
|
5373
5393
|
|
|
5374
5394
|
// src/task-graph/LoopBuilderContext.ts
|
|
5375
|
-
import { getLogger as
|
|
5395
|
+
import { getLogger as getLogger7 } from "@workglow/util";
|
|
5376
5396
|
function runLoopAutoConnect(parentGraph, pending) {
|
|
5377
5397
|
const { parent, iteratorTask } = pending;
|
|
5378
5398
|
if (parentGraph.getTargetDataflows(parent.id).length !== 0)
|
|
@@ -5386,7 +5406,7 @@ function runLoopAutoConnect(parentGraph, pending) {
|
|
|
5386
5406
|
const result = autoConnect(parentGraph, parent, iteratorTask, { earlierTasks });
|
|
5387
5407
|
if (result.error) {
|
|
5388
5408
|
const message = result.error + " Task not added.";
|
|
5389
|
-
|
|
5409
|
+
getLogger7().error(message);
|
|
5390
5410
|
parentGraph.removeTask(iteratorTask.id);
|
|
5391
5411
|
return message;
|
|
5392
5412
|
}
|
|
@@ -5425,7 +5445,7 @@ class LoopBuilderContext {
|
|
|
5425
5445
|
}
|
|
5426
5446
|
|
|
5427
5447
|
// src/task-graph/WorkflowBuilder.ts
|
|
5428
|
-
import { getLogger as
|
|
5448
|
+
import { getLogger as getLogger8, uuid4 as uuid47 } from "@workglow/util";
|
|
5429
5449
|
|
|
5430
5450
|
// src/task-graph/ConditionalBuilder.ts
|
|
5431
5451
|
import { uuid4 as uuid46 } from "@workglow/util";
|
|
@@ -5584,7 +5604,7 @@ class WorkflowBuilder {
|
|
|
5584
5604
|
const taskSchema = task.inputSchema();
|
|
5585
5605
|
if (typeof taskSchema !== "boolean" && taskSchema.properties?.[dataflow.targetTaskPortId] === undefined && taskSchema.additionalProperties !== true || taskSchema === true && dataflow.targetTaskPortId !== DATAFLOW_ALL_PORTS) {
|
|
5586
5606
|
this._error = `Input ${dataflow.targetTaskPortId} not found on task ${task.id}`;
|
|
5587
|
-
|
|
5607
|
+
getLogger8().error(this._error);
|
|
5588
5608
|
return;
|
|
5589
5609
|
}
|
|
5590
5610
|
dataflow.targetTaskId = task.id;
|
|
@@ -5609,10 +5629,10 @@ class WorkflowBuilder {
|
|
|
5609
5629
|
if (result.error) {
|
|
5610
5630
|
if (this._loopContext !== undefined) {
|
|
5611
5631
|
this._error = result.error;
|
|
5612
|
-
|
|
5632
|
+
getLogger8().warn(this._error);
|
|
5613
5633
|
} else {
|
|
5614
5634
|
this._error = result.error + " Task not added.";
|
|
5615
|
-
|
|
5635
|
+
getLogger8().error(this._error);
|
|
5616
5636
|
this._facade.graph.removeTask(task.id);
|
|
5617
5637
|
}
|
|
5618
5638
|
}
|
|
@@ -5635,7 +5655,7 @@ class WorkflowBuilder {
|
|
|
5635
5655
|
const taskSchema = task.inputSchema();
|
|
5636
5656
|
if (typeof taskSchema !== "boolean" && taskSchema.properties?.[dataflow.targetTaskPortId] === undefined && taskSchema.additionalProperties !== true || taskSchema === true && dataflow.targetTaskPortId !== DATAFLOW_ALL_PORTS) {
|
|
5637
5657
|
this._error = `Input ${dataflow.targetTaskPortId} not found on task ${task.id}`;
|
|
5638
|
-
|
|
5658
|
+
getLogger8().error(this._error);
|
|
5639
5659
|
return;
|
|
5640
5660
|
}
|
|
5641
5661
|
dataflow.targetTaskId = task.id;
|
|
@@ -5687,7 +5707,7 @@ class WorkflowBuilder {
|
|
|
5687
5707
|
if (-index > nodes.length) {
|
|
5688
5708
|
const errorMsg = `Back index greater than number of tasks`;
|
|
5689
5709
|
this._error = errorMsg;
|
|
5690
|
-
|
|
5710
|
+
getLogger8().error(this._error);
|
|
5691
5711
|
throw new WorkflowError(errorMsg);
|
|
5692
5712
|
}
|
|
5693
5713
|
const lastNode = nodes[nodes.length + index];
|
|
@@ -5696,13 +5716,13 @@ class WorkflowBuilder {
|
|
|
5696
5716
|
if (outputSchema === false && source !== DATAFLOW_ALL_PORTS) {
|
|
5697
5717
|
const errorMsg = `Task ${lastNode.id} has schema 'false' and outputs nothing`;
|
|
5698
5718
|
this._error = errorMsg;
|
|
5699
|
-
|
|
5719
|
+
getLogger8().error(this._error);
|
|
5700
5720
|
throw new WorkflowError(errorMsg);
|
|
5701
5721
|
}
|
|
5702
5722
|
} else if (!outputSchema.properties?.[source] && source !== DATAFLOW_ALL_PORTS) {
|
|
5703
5723
|
const errorMsg = `Output ${source} not found on task ${lastNode.id}`;
|
|
5704
5724
|
this._error = errorMsg;
|
|
5705
|
-
|
|
5725
|
+
getLogger8().error(this._error);
|
|
5706
5726
|
throw new WorkflowError(errorMsg);
|
|
5707
5727
|
}
|
|
5708
5728
|
const df = new Dataflow(lastNode.id, source, undefined, target);
|
|
@@ -5715,7 +5735,7 @@ class WorkflowBuilder {
|
|
|
5715
5735
|
const parent = getLastTask(this._facade);
|
|
5716
5736
|
if (!parent) {
|
|
5717
5737
|
this._error = "onError() requires a preceding task in the workflow";
|
|
5718
|
-
|
|
5738
|
+
getLogger8().error(this._error);
|
|
5719
5739
|
throw new WorkflowError(this._error);
|
|
5720
5740
|
}
|
|
5721
5741
|
const handlerTask = ensureTask(handler);
|
|
@@ -5729,7 +5749,7 @@ class WorkflowBuilder {
|
|
|
5729
5749
|
const nodes = this._facade.graph.getTasks();
|
|
5730
5750
|
if (nodes.length === 0) {
|
|
5731
5751
|
this._error = "No tasks to remove";
|
|
5732
|
-
|
|
5752
|
+
getLogger8().error(this._error);
|
|
5733
5753
|
return;
|
|
5734
5754
|
}
|
|
5735
5755
|
const lastNode = nodes[nodes.length - 1];
|
|
@@ -8416,7 +8436,8 @@ function wrapSchemaInArray(schema) {
|
|
|
8416
8436
|
import {
|
|
8417
8437
|
InMemoryQueueStorage,
|
|
8418
8438
|
JobQueueClient,
|
|
8419
|
-
JobQueueServer
|
|
8439
|
+
JobQueueServer,
|
|
8440
|
+
wrapQueueStorage
|
|
8420
8441
|
} from "@workglow/job-queue";
|
|
8421
8442
|
import { createServiceToken as createServiceToken7, globalServiceRegistry as globalServiceRegistry4 } from "@workglow/util";
|
|
8422
8443
|
var JOB_QUEUE_FACTORY = createServiceToken7("taskgraph.jobQueueFactory");
|
|
@@ -8427,8 +8448,10 @@ var defaultJobQueueFactory = async ({
|
|
|
8427
8448
|
}) => {
|
|
8428
8449
|
const storage = options?.storage ?? new InMemoryQueueStorage(queueName);
|
|
8429
8450
|
await storage.migrate();
|
|
8451
|
+
const { messageQueue, jobStore } = wrapQueueStorage(storage);
|
|
8430
8452
|
const server = new JobQueueServer(jobClass, {
|
|
8431
|
-
|
|
8453
|
+
messageQueue,
|
|
8454
|
+
jobStore,
|
|
8432
8455
|
queueName,
|
|
8433
8456
|
limiter: options?.limiter,
|
|
8434
8457
|
workerCount: options?.workerCount,
|
|
@@ -8440,7 +8463,8 @@ var defaultJobQueueFactory = async ({
|
|
|
8440
8463
|
stopTimeoutMs: options?.stopTimeoutMs
|
|
8441
8464
|
});
|
|
8442
8465
|
const client = new JobQueueClient({
|
|
8443
|
-
|
|
8466
|
+
messageQueue,
|
|
8467
|
+
jobStore,
|
|
8444
8468
|
queueName
|
|
8445
8469
|
});
|
|
8446
8470
|
client.attach(server);
|
|
@@ -8461,8 +8485,10 @@ function createJobQueueFactoryWithOptions(defaultOptions = {}) {
|
|
|
8461
8485
|
};
|
|
8462
8486
|
const storage = mergedOptions.storage ?? new InMemoryQueueStorage(queueName);
|
|
8463
8487
|
await storage.migrate();
|
|
8488
|
+
const { messageQueue, jobStore } = wrapQueueStorage(storage);
|
|
8464
8489
|
const server = new JobQueueServer(jobClass, {
|
|
8465
|
-
|
|
8490
|
+
messageQueue,
|
|
8491
|
+
jobStore,
|
|
8466
8492
|
queueName,
|
|
8467
8493
|
limiter: mergedOptions.limiter,
|
|
8468
8494
|
workerCount: mergedOptions.workerCount,
|
|
@@ -8474,7 +8500,8 @@ function createJobQueueFactoryWithOptions(defaultOptions = {}) {
|
|
|
8474
8500
|
stopTimeoutMs: mergedOptions.stopTimeoutMs
|
|
8475
8501
|
});
|
|
8476
8502
|
const client = new JobQueueClient({
|
|
8477
|
-
|
|
8503
|
+
messageQueue,
|
|
8504
|
+
jobStore,
|
|
8478
8505
|
queueName
|
|
8479
8506
|
});
|
|
8480
8507
|
client.attach(server);
|
|
@@ -8685,7 +8712,7 @@ queueMicrotask(() => {
|
|
|
8685
8712
|
// src/task/TaskRegistry.ts
|
|
8686
8713
|
import {
|
|
8687
8714
|
createServiceToken as createServiceToken8,
|
|
8688
|
-
getLogger as
|
|
8715
|
+
getLogger as getLogger9,
|
|
8689
8716
|
globalServiceRegistry as globalServiceRegistry5,
|
|
8690
8717
|
registerInputCompactor,
|
|
8691
8718
|
registerInputResolver
|
|
@@ -8708,7 +8735,7 @@ function registerTask(baseClass) {
|
|
|
8708
8735
|
const result = validateSchema(schema);
|
|
8709
8736
|
if (!result.valid) {
|
|
8710
8737
|
const messages = result.errors.map((e) => `${e.path}: ${e.message}`).join("; ");
|
|
8711
|
-
|
|
8738
|
+
getLogger9().warn(`Task "${baseClass.type}" has invalid ${name}: ${messages}`, {
|
|
8712
8739
|
taskType: baseClass.type,
|
|
8713
8740
|
schemaName: name,
|
|
8714
8741
|
errors: result.errors
|
|
@@ -9200,6 +9227,7 @@ export {
|
|
|
9200
9227
|
addBoundaryNodesToGraphJson,
|
|
9201
9228
|
addBoundaryNodesToDependencyJson,
|
|
9202
9229
|
_resetPortCodecsForTests,
|
|
9230
|
+
__resetCacheableDeprecationWarnings,
|
|
9203
9231
|
WorkflowRunContext,
|
|
9204
9232
|
WorkflowEventBridge,
|
|
9205
9233
|
WorkflowError,
|
|
@@ -9292,4 +9320,4 @@ export {
|
|
|
9292
9320
|
BROWSER_GRANTS
|
|
9293
9321
|
};
|
|
9294
9322
|
|
|
9295
|
-
//# debugId=
|
|
9323
|
+
//# debugId=5FDD8EEAEE6A0F2A64756E2164756E21
|