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