@workglow/task-graph 0.2.16 → 0.2.17
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 +8 -3
- package/dist/browser.js +101 -98
- package/dist/browser.js.map +10 -10
- package/dist/bun.js +101 -98
- package/dist/bun.js.map +10 -10
- package/dist/node.js +101 -98
- package/dist/node.js.map +10 -10
- package/dist/task/FallbackTaskRunner.d.ts +2 -2
- package/dist/task/FallbackTaskRunner.d.ts.map +1 -1
- package/dist/task/GraphAsTaskRunner.d.ts +5 -5
- package/dist/task/GraphAsTaskRunner.d.ts.map +1 -1
- package/dist/task/ITask.d.ts +3 -3
- package/dist/task/ITask.d.ts.map +1 -1
- package/dist/task/ITaskRunner.d.ts +2 -2
- package/dist/task/ITaskRunner.d.ts.map +1 -1
- package/dist/task/IteratorTaskRunner.d.ts +4 -3
- package/dist/task/IteratorTaskRunner.d.ts.map +1 -1
- package/dist/task/Task.d.ts +8 -9
- package/dist/task/Task.d.ts.map +1 -1
- package/dist/task/TaskRunner.d.ts +9 -9
- package/dist/task/TaskRunner.d.ts.map +1 -1
- package/dist/task/WhileTaskRunner.d.ts +2 -2
- package/dist/task/WhileTaskRunner.d.ts.map +1 -1
- package/dist/task-graph/ITaskGraph.d.ts +1 -1
- package/dist/task-graph/ITaskGraph.d.ts.map +1 -1
- package/dist/task-graph/TaskGraph.d.ts +3 -3
- package/dist/task-graph/TaskGraph.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphRunner.d.ts +13 -13
- package/dist/task-graph/TaskGraphRunner.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/EXECUTION_MODEL.md +132 -74
- package/src/task/README.md +5 -4
- package/src/task-graph/README.md +1 -1
package/dist/bun.js
CHANGED
|
@@ -1355,7 +1355,7 @@ function hasRunConfig(i) {
|
|
|
1355
1355
|
|
|
1356
1356
|
class TaskRunner {
|
|
1357
1357
|
running = false;
|
|
1358
|
-
|
|
1358
|
+
previewRunning = false;
|
|
1359
1359
|
task;
|
|
1360
1360
|
abortController;
|
|
1361
1361
|
outputCache;
|
|
@@ -1373,6 +1373,10 @@ class TaskRunner {
|
|
|
1373
1373
|
}
|
|
1374
1374
|
async run(overrides = {}, config = {}) {
|
|
1375
1375
|
await this.handleStart(config);
|
|
1376
|
+
const proto = Object.getPrototypeOf(this.task);
|
|
1377
|
+
if (proto.execute === Task.prototype.execute && typeof proto.executeStream !== "function" && proto.executePreview !== Task.prototype.executePreview) {
|
|
1378
|
+
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.`);
|
|
1379
|
+
}
|
|
1376
1380
|
try {
|
|
1377
1381
|
this.task.setInput(overrides);
|
|
1378
1382
|
const configSchema = this.task.constructor.configSchema();
|
|
@@ -1409,9 +1413,8 @@ class TaskRunner {
|
|
|
1409
1413
|
this.task.emit("stream_start");
|
|
1410
1414
|
this.task.emit("stream_chunk", { type: "finish", data: outputs });
|
|
1411
1415
|
this.task.emit("stream_end", outputs);
|
|
1412
|
-
this.task.runOutputData = await this.executeTaskReactive(inputs, outputs);
|
|
1413
1416
|
} else {
|
|
1414
|
-
this.task.runOutputData =
|
|
1417
|
+
this.task.runOutputData = outputs;
|
|
1415
1418
|
}
|
|
1416
1419
|
}
|
|
1417
1420
|
}
|
|
@@ -1433,7 +1436,7 @@ class TaskRunner {
|
|
|
1433
1436
|
throw this.task.error instanceof TaskTimeoutError ? this.task.error : err;
|
|
1434
1437
|
}
|
|
1435
1438
|
}
|
|
1436
|
-
async
|
|
1439
|
+
async runPreview(overrides = {}) {
|
|
1437
1440
|
if (this.task.status === TaskStatus.PROCESSING) {
|
|
1438
1441
|
return this.task.runOutputData;
|
|
1439
1442
|
}
|
|
@@ -1446,18 +1449,21 @@ class TaskRunner {
|
|
|
1446
1449
|
}
|
|
1447
1450
|
const schema = this.task.constructor.inputSchema();
|
|
1448
1451
|
this.task.runInputData = await resolveSchemaInputs(this.task.runInputData, schema, { registry: this.registry });
|
|
1449
|
-
await this.
|
|
1452
|
+
await this.handleStartPreview();
|
|
1450
1453
|
try {
|
|
1451
1454
|
const inputs = this.task.runInputData;
|
|
1452
1455
|
const isValid = await this.task.validateInput(inputs);
|
|
1453
1456
|
if (!isValid) {
|
|
1454
1457
|
throw new TaskInvalidInputError("Invalid input data");
|
|
1455
1458
|
}
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
+
const resultPreview = await this.executeTaskPreview(inputs);
|
|
1460
|
+
if (resultPreview !== undefined) {
|
|
1461
|
+
this.task.runOutputData = resultPreview;
|
|
1462
|
+
}
|
|
1463
|
+
await this.handleCompletePreview();
|
|
1459
1464
|
} catch (err) {
|
|
1460
|
-
|
|
1465
|
+
getLogger().debug("runPreview failed", { taskId: this.task.config?.id, error: err });
|
|
1466
|
+
await this.handleErrorPreview();
|
|
1461
1467
|
} finally {
|
|
1462
1468
|
return this.task.runOutputData;
|
|
1463
1469
|
}
|
|
@@ -1491,11 +1497,10 @@ class TaskRunner {
|
|
|
1491
1497
|
registry: this.registry,
|
|
1492
1498
|
resourceScope: this.resourceScope
|
|
1493
1499
|
});
|
|
1494
|
-
return
|
|
1500
|
+
return result;
|
|
1495
1501
|
}
|
|
1496
|
-
async
|
|
1497
|
-
|
|
1498
|
-
return Object.assign({}, output, reactiveResult ?? {});
|
|
1502
|
+
async executeTaskPreview(input) {
|
|
1503
|
+
return this.task.executePreview?.(input, { own: this.own });
|
|
1499
1504
|
}
|
|
1500
1505
|
async executeStreamingTask(input) {
|
|
1501
1506
|
const streamMode = getOutputStreamMode(this.task.outputSchema());
|
|
@@ -1614,8 +1619,7 @@ class TaskRunner {
|
|
|
1614
1619
|
this.task.runOutputData = finalOutput;
|
|
1615
1620
|
}
|
|
1616
1621
|
this.task.emit("stream_end", this.task.runOutputData);
|
|
1617
|
-
|
|
1618
|
-
return reactiveResult;
|
|
1622
|
+
return this.task.runOutputData;
|
|
1619
1623
|
}
|
|
1620
1624
|
async handleStart(config = {}) {
|
|
1621
1625
|
if (this.task.status === TaskStatus.PROCESSING)
|
|
@@ -1678,8 +1682,8 @@ class TaskRunner {
|
|
|
1678
1682
|
this.task.emit("status", this.task.status);
|
|
1679
1683
|
}
|
|
1680
1684
|
updateProgress = async (_task, _progress, _message, ..._args) => {};
|
|
1681
|
-
async
|
|
1682
|
-
this.
|
|
1685
|
+
async handleStartPreview() {
|
|
1686
|
+
this.previewRunning = true;
|
|
1683
1687
|
}
|
|
1684
1688
|
clearTimeoutTimer() {
|
|
1685
1689
|
if (this.timeoutTimer !== undefined) {
|
|
@@ -1711,8 +1715,8 @@ class TaskRunner {
|
|
|
1711
1715
|
this.task.emit("abort", this.task.error);
|
|
1712
1716
|
this.task.emit("status", this.task.status);
|
|
1713
1717
|
}
|
|
1714
|
-
async
|
|
1715
|
-
this.
|
|
1718
|
+
async handleAbortPreview() {
|
|
1719
|
+
this.previewRunning = false;
|
|
1716
1720
|
}
|
|
1717
1721
|
async handleComplete() {
|
|
1718
1722
|
if (this.task.status === TaskStatus.COMPLETED)
|
|
@@ -1731,8 +1735,8 @@ class TaskRunner {
|
|
|
1731
1735
|
this.task.emit("complete");
|
|
1732
1736
|
this.task.emit("status", this.task.status);
|
|
1733
1737
|
}
|
|
1734
|
-
async
|
|
1735
|
-
this.
|
|
1738
|
+
async handleCompletePreview() {
|
|
1739
|
+
this.previewRunning = false;
|
|
1736
1740
|
}
|
|
1737
1741
|
async handleDisable() {
|
|
1738
1742
|
if (this.task.status === TaskStatus.DISABLED)
|
|
@@ -1779,8 +1783,8 @@ class TaskRunner {
|
|
|
1779
1783
|
this.task.emit("error", this.task.error);
|
|
1780
1784
|
this.task.emit("status", this.task.status);
|
|
1781
1785
|
}
|
|
1782
|
-
async
|
|
1783
|
-
this.
|
|
1786
|
+
async handleErrorPreview() {
|
|
1787
|
+
this.previewRunning = false;
|
|
1784
1788
|
}
|
|
1785
1789
|
async handleProgress(progress, message, ...args) {
|
|
1786
1790
|
this.task.progress = progress;
|
|
@@ -1828,8 +1832,8 @@ class Task {
|
|
|
1828
1832
|
}
|
|
1829
1833
|
return;
|
|
1830
1834
|
}
|
|
1831
|
-
async
|
|
1832
|
-
return
|
|
1835
|
+
async executePreview(_input, _context) {
|
|
1836
|
+
return;
|
|
1833
1837
|
}
|
|
1834
1838
|
_runner;
|
|
1835
1839
|
get runner() {
|
|
@@ -1841,8 +1845,8 @@ class Task {
|
|
|
1841
1845
|
async run(overrides = {}, runConfig = {}) {
|
|
1842
1846
|
return this.runner.run(overrides, { ...this.runConfig, ...runConfig });
|
|
1843
1847
|
}
|
|
1844
|
-
async
|
|
1845
|
-
return this.runner.
|
|
1848
|
+
async runPreview(overrides = {}) {
|
|
1849
|
+
return this.runner.runPreview(overrides);
|
|
1846
1850
|
}
|
|
1847
1851
|
abort() {
|
|
1848
1852
|
this.runner.abort();
|
|
@@ -2803,9 +2807,9 @@ var GRAPH_RESULT_ARRAY = "GRAPH_RESULT_ARRAY";
|
|
|
2803
2807
|
|
|
2804
2808
|
class TaskGraphRunner {
|
|
2805
2809
|
processScheduler;
|
|
2806
|
-
|
|
2810
|
+
previewScheduler;
|
|
2807
2811
|
running = false;
|
|
2808
|
-
|
|
2812
|
+
previewRunning = false;
|
|
2809
2813
|
graph;
|
|
2810
2814
|
outputCache;
|
|
2811
2815
|
accumulateLeafOutputs = true;
|
|
@@ -2819,9 +2823,9 @@ class TaskGraphRunner {
|
|
|
2819
2823
|
graphTimeoutTimer;
|
|
2820
2824
|
pendingGraphTimeoutError;
|
|
2821
2825
|
activeEnforcer;
|
|
2822
|
-
constructor(graph, outputCache, processScheduler = new DependencyBasedScheduler(graph),
|
|
2826
|
+
constructor(graph, outputCache, processScheduler = new DependencyBasedScheduler(graph), previewScheduler = new TopologicalScheduler(graph)) {
|
|
2823
2827
|
this.processScheduler = processScheduler;
|
|
2824
|
-
this.
|
|
2828
|
+
this.previewScheduler = previewScheduler;
|
|
2825
2829
|
this.graph = graph;
|
|
2826
2830
|
graph.outputCache = outputCache;
|
|
2827
2831
|
this.handleProgress = this.handleProgress.bind(this);
|
|
@@ -2889,16 +2893,16 @@ class TaskGraphRunner {
|
|
|
2889
2893
|
await this.handleComplete();
|
|
2890
2894
|
return this.filterLeafResults(results);
|
|
2891
2895
|
}
|
|
2892
|
-
async
|
|
2893
|
-
await this.
|
|
2896
|
+
async runGraphPreview(input = {}, config) {
|
|
2897
|
+
await this.handleStartPreview(config);
|
|
2894
2898
|
const telemetry = getTelemetryProvider2();
|
|
2895
2899
|
const telemetryEnabled = telemetry.isEnabled;
|
|
2896
|
-
const
|
|
2897
|
-
let
|
|
2900
|
+
const previewRunId = telemetryEnabled ? uuid43() : "";
|
|
2901
|
+
let previewSpan;
|
|
2898
2902
|
if (telemetryEnabled) {
|
|
2899
|
-
|
|
2903
|
+
previewSpan = telemetry.startSpan("workglow.graph.runPreview", {
|
|
2900
2904
|
attributes: {
|
|
2901
|
-
"workglow.graph.
|
|
2905
|
+
"workglow.graph.preview.run_id": previewRunId,
|
|
2902
2906
|
"workglow.graph.task_count": this.graph.getTasks().length,
|
|
2903
2907
|
"workglow.graph.dataflow_count": this.graph.getDataflows().length
|
|
2904
2908
|
}
|
|
@@ -2908,7 +2912,7 @@ class TaskGraphRunner {
|
|
|
2908
2912
|
const taskTimings = [];
|
|
2909
2913
|
const results = [];
|
|
2910
2914
|
try {
|
|
2911
|
-
for await (const task of this.
|
|
2915
|
+
for await (const task of this.previewScheduler.tasks()) {
|
|
2912
2916
|
const isRootTask = this.graph.getSourceDataflows(task.id).length === 0;
|
|
2913
2917
|
if (task.status === TaskStatus.PENDING) {
|
|
2914
2918
|
task.resetInputData();
|
|
@@ -2917,13 +2921,13 @@ class TaskGraphRunner {
|
|
|
2917
2921
|
const taskInput = isRootTask ? input : {};
|
|
2918
2922
|
if (telemetryEnabled) {
|
|
2919
2923
|
const taskType = String(task.constructor.runtype || task.constructor.type || "?");
|
|
2920
|
-
const
|
|
2921
|
-
const taskResult = await task.
|
|
2922
|
-
const
|
|
2924
|
+
const tPreview = performance.now();
|
|
2925
|
+
const taskResult = await task.runPreview(taskInput);
|
|
2926
|
+
const runPreviewMs = performance.now() - tPreview;
|
|
2923
2927
|
const tPush = performance.now();
|
|
2924
2928
|
await this.pushOutputFromNodeToEdges(task, taskResult);
|
|
2925
2929
|
const pushOutputMs = performance.now() - tPush;
|
|
2926
|
-
taskTimings.push({ id: task.id, type: taskType,
|
|
2930
|
+
taskTimings.push({ id: task.id, type: taskType, runPreviewMs, pushOutputMs });
|
|
2927
2931
|
if (this.graph.getTargetDataflows(task.id).length === 0) {
|
|
2928
2932
|
results.push({
|
|
2929
2933
|
id: task.id,
|
|
@@ -2932,7 +2936,7 @@ class TaskGraphRunner {
|
|
|
2932
2936
|
});
|
|
2933
2937
|
}
|
|
2934
2938
|
} else {
|
|
2935
|
-
const taskResult = await task.
|
|
2939
|
+
const taskResult = await task.runPreview(taskInput);
|
|
2936
2940
|
await this.pushOutputFromNodeToEdges(task, taskResult);
|
|
2937
2941
|
if (this.graph.getTargetDataflows(task.id).length === 0) {
|
|
2938
2942
|
results.push({
|
|
@@ -2943,35 +2947,35 @@ class TaskGraphRunner {
|
|
|
2943
2947
|
}
|
|
2944
2948
|
}
|
|
2945
2949
|
}
|
|
2946
|
-
await this.
|
|
2947
|
-
if (
|
|
2950
|
+
await this.handleCompletePreview();
|
|
2951
|
+
if (previewSpan) {
|
|
2948
2952
|
const totalMs = performance.now() - t0;
|
|
2949
|
-
|
|
2950
|
-
"workglow.graph.
|
|
2951
|
-
"workglow.graph.
|
|
2953
|
+
previewSpan.setAttributes({
|
|
2954
|
+
"workglow.graph.preview.duration_ms": Math.round(totalMs * 1000) / 1000,
|
|
2955
|
+
"workglow.graph.preview.tasks_executed": taskTimings.length
|
|
2952
2956
|
});
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
getLogger3().debug("task graph
|
|
2956
|
-
|
|
2957
|
+
previewSpan.setStatus(SpanStatusCode2.OK);
|
|
2958
|
+
previewSpan.end();
|
|
2959
|
+
getLogger3().debug("task graph runPreview timings", {
|
|
2960
|
+
previewRunId,
|
|
2957
2961
|
totalMs: Math.round(totalMs * 1000) / 1000,
|
|
2958
2962
|
taskTimings
|
|
2959
2963
|
});
|
|
2960
2964
|
}
|
|
2961
2965
|
return this.filterLeafResults(results);
|
|
2962
2966
|
} catch (error) {
|
|
2963
|
-
await this.
|
|
2964
|
-
if (
|
|
2967
|
+
await this.handleErrorPreview();
|
|
2968
|
+
if (previewSpan) {
|
|
2965
2969
|
const totalMs = performance.now() - t0;
|
|
2966
2970
|
const message = error instanceof Error ? error.message : String(error);
|
|
2967
|
-
|
|
2968
|
-
"workglow.graph.
|
|
2969
|
-
"workglow.graph.
|
|
2971
|
+
previewSpan.setAttributes({
|
|
2972
|
+
"workglow.graph.preview.duration_ms": Math.round(totalMs * 1000) / 1000,
|
|
2973
|
+
"workglow.graph.preview.tasks_executed": taskTimings.length
|
|
2970
2974
|
});
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
getLogger3().debug("task graph
|
|
2974
|
-
|
|
2975
|
+
previewSpan.setStatus(SpanStatusCode2.ERROR, message);
|
|
2976
|
+
previewSpan.end();
|
|
2977
|
+
getLogger3().debug("task graph runPreview failed", {
|
|
2978
|
+
previewRunId,
|
|
2975
2979
|
totalMs: Math.round(totalMs * 1000) / 1000,
|
|
2976
2980
|
taskTimings,
|
|
2977
2981
|
error
|
|
@@ -3382,7 +3386,7 @@ class TaskGraphRunner {
|
|
|
3382
3386
|
}
|
|
3383
3387
|
this.graph.outputCache = this.outputCache;
|
|
3384
3388
|
}
|
|
3385
|
-
if (this.running || this.
|
|
3389
|
+
if (this.running || this.previewRunning) {
|
|
3386
3390
|
throw new TaskConfigurationError("Graph is already running");
|
|
3387
3391
|
}
|
|
3388
3392
|
this.running = true;
|
|
@@ -3456,9 +3460,9 @@ class TaskGraphRunner {
|
|
|
3456
3460
|
}
|
|
3457
3461
|
this.graph.emit("start");
|
|
3458
3462
|
}
|
|
3459
|
-
async
|
|
3460
|
-
if (this.
|
|
3461
|
-
throw new TaskConfigurationError("Graph is already running
|
|
3463
|
+
async handleStartPreview(config) {
|
|
3464
|
+
if (this.previewRunning) {
|
|
3465
|
+
throw new TaskConfigurationError("Graph is already running in preview");
|
|
3462
3466
|
}
|
|
3463
3467
|
if (config?.registry !== undefined) {
|
|
3464
3468
|
this.registry = config.registry;
|
|
@@ -3469,8 +3473,8 @@ class TaskGraphRunner {
|
|
|
3469
3473
|
throw new TaskConfigurationError(`Graph has ${taskCount} tasks, exceeding the limit of ${config.maxTasks}`);
|
|
3470
3474
|
}
|
|
3471
3475
|
}
|
|
3472
|
-
this.
|
|
3473
|
-
this.
|
|
3476
|
+
this.previewScheduler.reset();
|
|
3477
|
+
this.previewRunning = true;
|
|
3474
3478
|
}
|
|
3475
3479
|
clearGraphTimeout() {
|
|
3476
3480
|
if (this.graphTimeoutTimer !== undefined) {
|
|
@@ -3489,8 +3493,8 @@ class TaskGraphRunner {
|
|
|
3489
3493
|
}
|
|
3490
3494
|
this.graph.emit("complete");
|
|
3491
3495
|
}
|
|
3492
|
-
async
|
|
3493
|
-
this.
|
|
3496
|
+
async handleCompletePreview() {
|
|
3497
|
+
this.previewRunning = false;
|
|
3494
3498
|
}
|
|
3495
3499
|
async handleError(error) {
|
|
3496
3500
|
this.clearGraphTimeout();
|
|
@@ -3509,8 +3513,8 @@ class TaskGraphRunner {
|
|
|
3509
3513
|
}
|
|
3510
3514
|
this.graph.emit("error", error);
|
|
3511
3515
|
}
|
|
3512
|
-
async
|
|
3513
|
-
this.
|
|
3516
|
+
async handleErrorPreview() {
|
|
3517
|
+
this.previewRunning = false;
|
|
3514
3518
|
}
|
|
3515
3519
|
async handleAbort() {
|
|
3516
3520
|
this.clearGraphTimeout();
|
|
@@ -3529,8 +3533,8 @@ class TaskGraphRunner {
|
|
|
3529
3533
|
}
|
|
3530
3534
|
this.graph.emit("abort");
|
|
3531
3535
|
}
|
|
3532
|
-
async
|
|
3533
|
-
this.
|
|
3536
|
+
async handleAbortPreview() {
|
|
3537
|
+
this.previewRunning = false;
|
|
3534
3538
|
}
|
|
3535
3539
|
async handleDisable() {
|
|
3536
3540
|
await Promise.allSettled(this.graph.getTasks().map(async (task) => {
|
|
@@ -3573,8 +3577,8 @@ class GraphAsTaskRunner extends TaskRunner {
|
|
|
3573
3577
|
unsubscribe();
|
|
3574
3578
|
return results;
|
|
3575
3579
|
}
|
|
3576
|
-
async
|
|
3577
|
-
return this.task.subGraph.
|
|
3580
|
+
async executeTaskChildrenPreview() {
|
|
3581
|
+
return this.task.subGraph.runPreview(this.task.runInputData, {
|
|
3578
3582
|
registry: this.registry,
|
|
3579
3583
|
resourceScope: this.resourceScope
|
|
3580
3584
|
});
|
|
@@ -3595,15 +3599,18 @@ class GraphAsTaskRunner extends TaskRunner {
|
|
|
3595
3599
|
}
|
|
3596
3600
|
return this.task.runOutputData;
|
|
3597
3601
|
}
|
|
3598
|
-
async
|
|
3602
|
+
async executeTaskPreview(input) {
|
|
3599
3603
|
if (this.task.hasChildren()) {
|
|
3600
|
-
const
|
|
3601
|
-
this.task.runOutputData = this.task.subGraph.mergeExecuteOutputsToRunOutput(
|
|
3604
|
+
const previewResults = await this.executeTaskChildrenPreview();
|
|
3605
|
+
this.task.runOutputData = this.task.subGraph.mergeExecuteOutputsToRunOutput(previewResults, this.task.compoundMerge);
|
|
3606
|
+
return this.task.runOutputData;
|
|
3602
3607
|
} else {
|
|
3603
|
-
const
|
|
3604
|
-
|
|
3608
|
+
const previewResult = await super.executeTaskPreview(input);
|
|
3609
|
+
if (previewResult !== undefined) {
|
|
3610
|
+
this.task.runOutputData = previewResult;
|
|
3611
|
+
}
|
|
3612
|
+
return this.task.runOutputData;
|
|
3605
3613
|
}
|
|
3606
|
-
return this.task.runOutputData;
|
|
3607
3614
|
}
|
|
3608
3615
|
}
|
|
3609
3616
|
|
|
@@ -4031,8 +4038,8 @@ class TaskGraph {
|
|
|
4031
4038
|
resourceScope: config?.resourceScope
|
|
4032
4039
|
});
|
|
4033
4040
|
}
|
|
4034
|
-
|
|
4035
|
-
return this.runner.
|
|
4041
|
+
runPreview(input = {}, config = {}) {
|
|
4042
|
+
return this.runner.runGraphPreview(input, config);
|
|
4036
4043
|
}
|
|
4037
4044
|
mergeExecuteOutputsToRunOutput(results, compoundMerge) {
|
|
4038
4045
|
return this.runner.mergeExecuteOutputsToRunOutput(results, compoundMerge);
|
|
@@ -5922,9 +5929,8 @@ class FallbackTaskRunner extends GraphAsTaskRunner {
|
|
|
5922
5929
|
}
|
|
5923
5930
|
return this.executeTaskFallback(input);
|
|
5924
5931
|
}
|
|
5925
|
-
async
|
|
5926
|
-
|
|
5927
|
-
return Object.assign({}, output, reactiveResult ?? {});
|
|
5932
|
+
async executeTaskPreview(input) {
|
|
5933
|
+
return this.task.executePreview?.(input, { own: this.own });
|
|
5928
5934
|
}
|
|
5929
5935
|
async executeTaskFallback(input) {
|
|
5930
5936
|
const tasks = this.task.subGraph.getTasks();
|
|
@@ -5944,7 +5950,7 @@ class FallbackTaskRunner extends GraphAsTaskRunner {
|
|
|
5944
5950
|
this.resetTask(alternativeTask);
|
|
5945
5951
|
const result = await alternativeTask.run(input);
|
|
5946
5952
|
await this.handleProgress(100, `Alternative ${attemptNumber}/${totalAttempts} succeeded: ${alternativeTask.type}`);
|
|
5947
|
-
return
|
|
5953
|
+
return result;
|
|
5948
5954
|
} catch (error) {
|
|
5949
5955
|
if (error instanceof TaskAbortedError && !(error instanceof TaskTimeoutError)) {
|
|
5950
5956
|
throw error;
|
|
@@ -5986,7 +5992,7 @@ class FallbackTaskRunner extends GraphAsTaskRunner {
|
|
|
5986
5992
|
});
|
|
5987
5993
|
const mergedOutput = this.task.subGraph.mergeExecuteOutputsToRunOutput(results, this.task.compoundMerge);
|
|
5988
5994
|
await this.handleProgress(100, `Data alternative ${attemptNumber}/${totalAttempts} succeeded`);
|
|
5989
|
-
return
|
|
5995
|
+
return mergedOutput;
|
|
5990
5996
|
} catch (error) {
|
|
5991
5997
|
if (error instanceof TaskAbortedError && !(error instanceof TaskTimeoutError)) {
|
|
5992
5998
|
throw error;
|
|
@@ -6214,15 +6220,13 @@ class IteratorTaskRunner extends GraphAsTaskRunner {
|
|
|
6214
6220
|
analysis = { ...analysis, iterationCount: maxIterations };
|
|
6215
6221
|
}
|
|
6216
6222
|
if (analysis.iterationCount === 0) {
|
|
6217
|
-
|
|
6218
|
-
return this.executeTaskReactive(input, emptyResult);
|
|
6223
|
+
return this.task.getEmptyResult();
|
|
6219
6224
|
}
|
|
6220
6225
|
const result = this.task.isReduceTask() ? await this.executeReduceIterations(analysis) : await this.executeCollectIterations(analysis);
|
|
6221
|
-
return
|
|
6226
|
+
return result;
|
|
6222
6227
|
}
|
|
6223
|
-
async
|
|
6224
|
-
|
|
6225
|
-
return Object.assign({}, output, reactiveResult ?? {});
|
|
6228
|
+
async executeTaskPreview(input) {
|
|
6229
|
+
return this.task.executePreview?.(input, { own: this.own });
|
|
6226
6230
|
}
|
|
6227
6231
|
async executeCollectIterations(analysis) {
|
|
6228
6232
|
const iterationCount = analysis.iterationCount;
|
|
@@ -6889,9 +6893,8 @@ class WhileTaskRunner extends GraphAsTaskRunner {
|
|
|
6889
6893
|
});
|
|
6890
6894
|
return result;
|
|
6891
6895
|
}
|
|
6892
|
-
async
|
|
6893
|
-
|
|
6894
|
-
return Object.assign({}, output, reactiveResult ?? {});
|
|
6896
|
+
async executeTaskPreview(input) {
|
|
6897
|
+
return this.task.executePreview?.(input, { own: this.own });
|
|
6895
6898
|
}
|
|
6896
6899
|
}
|
|
6897
6900
|
|
|
@@ -8298,4 +8301,4 @@ export {
|
|
|
8298
8301
|
BROWSER_GRANTS
|
|
8299
8302
|
};
|
|
8300
8303
|
|
|
8301
|
-
//# debugId=
|
|
8304
|
+
//# debugId=6F0C663FBE6F199E64756E2164756E21
|