@elaraai/e3-core 0.0.2-beta.3 → 0.0.2-beta.31
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 +25 -22
- package/dist/src/dataflow/api-compat.d.ts +90 -0
- package/dist/src/dataflow/api-compat.d.ts.map +1 -0
- package/dist/src/dataflow/api-compat.js +134 -0
- package/dist/src/dataflow/api-compat.js.map +1 -0
- package/dist/src/dataflow/index.d.ts +18 -0
- package/dist/src/dataflow/index.d.ts.map +1 -0
- package/dist/src/dataflow/index.js +23 -0
- package/dist/src/dataflow/index.js.map +1 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts +53 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.d.ts.map +1 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.js +416 -0
- package/dist/src/dataflow/orchestrator/LocalOrchestrator.js.map +1 -0
- package/dist/src/dataflow/orchestrator/index.d.ts +12 -0
- package/dist/src/dataflow/orchestrator/index.d.ts.map +1 -0
- package/dist/src/dataflow/orchestrator/index.js +12 -0
- package/dist/src/dataflow/orchestrator/index.js.map +1 -0
- package/dist/src/dataflow/orchestrator/interfaces.d.ts +157 -0
- package/dist/src/dataflow/orchestrator/interfaces.d.ts.map +1 -0
- package/dist/src/dataflow/orchestrator/interfaces.js +51 -0
- package/dist/src/dataflow/orchestrator/interfaces.js.map +1 -0
- package/dist/src/dataflow/state-store/FileStateStore.d.ts +67 -0
- package/dist/src/dataflow/state-store/FileStateStore.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/FileStateStore.js +286 -0
- package/dist/src/dataflow/state-store/FileStateStore.js.map +1 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts +42 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.js +214 -0
- package/dist/src/dataflow/state-store/InMemoryStateStore.js.map +1 -0
- package/dist/src/dataflow/state-store/index.d.ts +13 -0
- package/dist/src/dataflow/state-store/index.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/index.js +13 -0
- package/dist/src/dataflow/state-store/index.js.map +1 -0
- package/dist/src/dataflow/state-store/interfaces.d.ts +159 -0
- package/dist/src/dataflow/state-store/interfaces.d.ts.map +1 -0
- package/dist/src/dataflow/state-store/interfaces.js +6 -0
- package/dist/src/dataflow/state-store/interfaces.js.map +1 -0
- package/dist/src/dataflow/steps.d.ts +176 -0
- package/dist/src/dataflow/steps.d.ts.map +1 -0
- package/dist/src/dataflow/steps.js +528 -0
- package/dist/src/dataflow/steps.js.map +1 -0
- package/dist/src/dataflow/types.d.ts +116 -0
- package/dist/src/dataflow/types.d.ts.map +1 -0
- package/dist/src/dataflow/types.js +7 -0
- package/dist/src/dataflow/types.js.map +1 -0
- package/dist/src/dataflow.d.ts +142 -9
- package/dist/src/dataflow.d.ts.map +1 -1
- package/dist/src/dataflow.js +427 -64
- package/dist/src/dataflow.js.map +1 -1
- package/dist/src/errors.d.ts +39 -9
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +51 -8
- package/dist/src/errors.js.map +1 -1
- package/dist/src/execution/LocalTaskRunner.d.ts +73 -0
- package/dist/src/execution/LocalTaskRunner.d.ts.map +1 -0
- package/dist/src/execution/LocalTaskRunner.js +399 -0
- package/dist/src/execution/LocalTaskRunner.js.map +1 -0
- package/dist/src/execution/MockTaskRunner.d.ts +49 -0
- package/dist/src/execution/MockTaskRunner.d.ts.map +1 -0
- package/dist/src/execution/MockTaskRunner.js +55 -0
- package/dist/src/execution/MockTaskRunner.js.map +1 -0
- package/dist/src/execution/index.d.ts +16 -0
- package/dist/src/execution/index.d.ts.map +1 -0
- package/dist/src/execution/index.js +8 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/interfaces.d.ts +246 -0
- package/dist/src/execution/interfaces.d.ts.map +1 -0
- package/dist/src/execution/interfaces.js +6 -0
- package/dist/src/execution/interfaces.js.map +1 -0
- package/dist/src/execution/processHelpers.d.ts +20 -0
- package/dist/src/execution/processHelpers.d.ts.map +1 -0
- package/dist/src/execution/processHelpers.js +62 -0
- package/dist/src/execution/processHelpers.js.map +1 -0
- package/dist/src/executions.d.ts +71 -104
- package/dist/src/executions.d.ts.map +1 -1
- package/dist/src/executions.js +110 -476
- package/dist/src/executions.js.map +1 -1
- package/dist/src/index.d.ts +17 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +44 -18
- package/dist/src/index.js.map +1 -1
- package/dist/src/objects.d.ts +6 -53
- package/dist/src/objects.d.ts.map +1 -1
- package/dist/src/objects.js +11 -232
- package/dist/src/objects.js.map +1 -1
- package/dist/src/packages.d.ts +22 -14
- package/dist/src/packages.d.ts.map +1 -1
- package/dist/src/packages.js +116 -83
- package/dist/src/packages.js.map +1 -1
- package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts +35 -0
- package/dist/src/storage/in-memory/InMemoryRepoStore.d.ts.map +1 -0
- package/dist/src/storage/in-memory/InMemoryRepoStore.js +107 -0
- package/dist/src/storage/in-memory/InMemoryRepoStore.js.map +1 -0
- package/dist/src/storage/in-memory/InMemoryStorage.d.ts +114 -0
- package/dist/src/storage/in-memory/InMemoryStorage.d.ts.map +1 -0
- package/dist/src/storage/in-memory/InMemoryStorage.js +349 -0
- package/dist/src/storage/in-memory/InMemoryStorage.js.map +1 -0
- package/dist/src/storage/in-memory/index.d.ts +12 -0
- package/dist/src/storage/in-memory/index.d.ts.map +1 -0
- package/dist/src/storage/in-memory/index.js +12 -0
- package/dist/src/storage/in-memory/index.js.map +1 -0
- package/dist/src/storage/index.d.ts +18 -0
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/src/storage/index.js +10 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/interfaces.d.ts +520 -0
- package/dist/src/storage/interfaces.d.ts.map +1 -0
- package/dist/src/storage/interfaces.js +6 -0
- package/dist/src/storage/interfaces.js.map +1 -0
- package/dist/src/storage/local/LocalBackend.d.ts +54 -0
- package/dist/src/storage/local/LocalBackend.d.ts.map +1 -0
- package/dist/src/storage/local/LocalBackend.js +141 -0
- package/dist/src/storage/local/LocalBackend.js.map +1 -0
- package/dist/src/storage/local/LocalLockService.d.ts +105 -0
- package/dist/src/storage/local/LocalLockService.d.ts.map +1 -0
- package/dist/src/storage/local/LocalLockService.js +342 -0
- package/dist/src/storage/local/LocalLockService.js.map +1 -0
- package/dist/src/storage/local/LocalLogStore.d.ts +23 -0
- package/dist/src/storage/local/LocalLogStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalLogStore.js +66 -0
- package/dist/src/storage/local/LocalLogStore.js.map +1 -0
- package/dist/src/storage/local/LocalObjectStore.d.ts +52 -0
- package/dist/src/storage/local/LocalObjectStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalObjectStore.js +287 -0
- package/dist/src/storage/local/LocalObjectStore.js.map +1 -0
- package/dist/src/storage/local/LocalRefStore.d.ts +50 -0
- package/dist/src/storage/local/LocalRefStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalRefStore.js +337 -0
- package/dist/src/storage/local/LocalRefStore.js.map +1 -0
- package/dist/src/storage/local/LocalRepoStore.d.ts +53 -0
- package/dist/src/storage/local/LocalRepoStore.d.ts.map +1 -0
- package/dist/src/storage/local/LocalRepoStore.js +353 -0
- package/dist/src/storage/local/LocalRepoStore.js.map +1 -0
- package/dist/src/storage/local/gc.d.ts +92 -0
- package/dist/src/storage/local/gc.d.ts.map +1 -0
- package/dist/src/storage/local/gc.js +322 -0
- package/dist/src/storage/local/gc.js.map +1 -0
- package/dist/src/storage/local/index.d.ts +17 -0
- package/dist/src/storage/local/index.d.ts.map +1 -0
- package/dist/src/storage/local/index.js +17 -0
- package/dist/src/storage/local/index.js.map +1 -0
- package/dist/src/storage/local/localHelpers.d.ts +25 -0
- package/dist/src/storage/local/localHelpers.d.ts.map +1 -0
- package/dist/src/storage/local/localHelpers.js +69 -0
- package/dist/src/storage/local/localHelpers.js.map +1 -0
- package/dist/src/{repository.d.ts → storage/local/repository.d.ts} +8 -4
- package/dist/src/storage/local/repository.d.ts.map +1 -0
- package/dist/src/{repository.js → storage/local/repository.js} +31 -29
- package/dist/src/storage/local/repository.js.map +1 -0
- package/dist/src/tasks.d.ts +16 -10
- package/dist/src/tasks.d.ts.map +1 -1
- package/dist/src/tasks.js +35 -41
- package/dist/src/tasks.js.map +1 -1
- package/dist/src/test-helpers.d.ts +4 -4
- package/dist/src/test-helpers.d.ts.map +1 -1
- package/dist/src/test-helpers.js +7 -21
- package/dist/src/test-helpers.js.map +1 -1
- package/dist/src/trees.d.ts +89 -27
- package/dist/src/trees.d.ts.map +1 -1
- package/dist/src/trees.js +218 -100
- package/dist/src/trees.js.map +1 -1
- package/dist/src/uuid.d.ts +26 -0
- package/dist/src/uuid.d.ts.map +1 -0
- package/dist/src/uuid.js +80 -0
- package/dist/src/uuid.js.map +1 -0
- package/dist/src/workspaceStatus.d.ts +6 -4
- package/dist/src/workspaceStatus.d.ts.map +1 -1
- package/dist/src/workspaceStatus.js +43 -49
- package/dist/src/workspaceStatus.js.map +1 -1
- package/dist/src/workspaces.d.ts +35 -26
- package/dist/src/workspaces.d.ts.map +1 -1
- package/dist/src/workspaces.js +169 -118
- package/dist/src/workspaces.js.map +1 -1
- package/package.json +4 -4
- package/dist/src/gc.d.ts +0 -54
- package/dist/src/gc.d.ts.map +0 -1
- package/dist/src/gc.js +0 -233
- package/dist/src/gc.js.map +0 -1
- package/dist/src/repository.d.ts.map +0 -1
- package/dist/src/repository.js.map +0 -1
- package/dist/src/workspaceLock.d.ts +0 -67
- package/dist/src/workspaceLock.d.ts.map +0 -1
- package/dist/src/workspaceLock.js +0 -217
- package/dist/src/workspaceLock.js.map +0 -1
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Local in-process dataflow orchestrator.
|
|
7
|
+
*
|
|
8
|
+
* Executes dataflow using an async loop with step functions.
|
|
9
|
+
* This is the default orchestrator for CLI and local API server usage.
|
|
10
|
+
*/
|
|
11
|
+
import { variant } from '@elaraai/east';
|
|
12
|
+
import { taskExecute } from '../../execution/LocalTaskRunner.js';
|
|
13
|
+
import { workspaceSetDatasetByHash } from '../../trees.js';
|
|
14
|
+
import { parsePathString } from '../../dataflow.js';
|
|
15
|
+
import { WorkspaceLockError, DataflowAbortedError } from '../../errors.js';
|
|
16
|
+
import { stateToStatus } from './interfaces.js';
|
|
17
|
+
import { stepInitialize, stepGetReady, stepPrepareTask, stepTaskStarted, stepTaskCompleted, stepTaskFailed, stepTasksSkipped, stepIsComplete, stepFinalize, stepCancel, } from '../steps.js';
|
|
18
|
+
/**
|
|
19
|
+
* Simple async mutex to serialize workspace state updates.
|
|
20
|
+
*
|
|
21
|
+
* When multiple tasks complete concurrently, their workspace writes must be
|
|
22
|
+
* serialized to prevent race conditions (read-modify-write on the workspace
|
|
23
|
+
* root hash). This mutex ensures only one update runs at a time.
|
|
24
|
+
*/
|
|
25
|
+
class AsyncMutex {
|
|
26
|
+
queue = [];
|
|
27
|
+
locked = false;
|
|
28
|
+
/**
|
|
29
|
+
* Acquire the mutex, execute the callback, then release.
|
|
30
|
+
* If the mutex is already held, waits until it's available.
|
|
31
|
+
*/
|
|
32
|
+
async runExclusive(fn) {
|
|
33
|
+
await this.acquire();
|
|
34
|
+
try {
|
|
35
|
+
return await fn();
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
this.release();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
acquire() {
|
|
42
|
+
return new Promise((resolve) => {
|
|
43
|
+
if (!this.locked) {
|
|
44
|
+
this.locked = true;
|
|
45
|
+
resolve();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.queue.push(resolve);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
release() {
|
|
53
|
+
const next = this.queue.shift();
|
|
54
|
+
if (next) {
|
|
55
|
+
next();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.locked = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Local orchestrator for in-process dataflow execution.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* - Uses step functions for each operation
|
|
67
|
+
* - Serializes workspace writes with AsyncMutex
|
|
68
|
+
* - Supports AbortSignal for cancellation
|
|
69
|
+
* - Persists state through the provided state store
|
|
70
|
+
*/
|
|
71
|
+
export class LocalOrchestrator {
|
|
72
|
+
stateStore;
|
|
73
|
+
executions = new Map();
|
|
74
|
+
/**
|
|
75
|
+
* Create a new LocalOrchestrator.
|
|
76
|
+
*
|
|
77
|
+
* @param stateStore - Optional state store for persistence.
|
|
78
|
+
* If not provided, state is only kept in memory.
|
|
79
|
+
*/
|
|
80
|
+
constructor(stateStore) {
|
|
81
|
+
this.stateStore = stateStore;
|
|
82
|
+
}
|
|
83
|
+
async start(storage, repo, workspace, options = {}) {
|
|
84
|
+
// Acquire lock if not provided externally
|
|
85
|
+
const externalLock = !!options.lock;
|
|
86
|
+
const lock = options.lock ?? await storage.locks.acquire(repo, workspace, variant('dataflow', null));
|
|
87
|
+
if (!lock) {
|
|
88
|
+
throw new WorkspaceLockError(workspace);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
// Get next execution ID from state store if available
|
|
92
|
+
const executionId = this.stateStore
|
|
93
|
+
? await this.stateStore.nextExecutionId(repo, workspace)
|
|
94
|
+
: String(Date.now()); // Fallback to timestamp if no state store
|
|
95
|
+
// Initialize execution state
|
|
96
|
+
const { state, readyTasks: _ } = await stepInitialize(storage, repo, workspace, executionId, {
|
|
97
|
+
concurrency: options.concurrency,
|
|
98
|
+
force: options.force,
|
|
99
|
+
filter: options.filter,
|
|
100
|
+
});
|
|
101
|
+
// Persist initial state
|
|
102
|
+
if (this.stateStore) {
|
|
103
|
+
await this.stateStore.create(state);
|
|
104
|
+
}
|
|
105
|
+
// Create completion promise
|
|
106
|
+
let resolveCompletion;
|
|
107
|
+
let rejectCompletion;
|
|
108
|
+
const completionPromise = new Promise((resolve, reject) => {
|
|
109
|
+
resolveCompletion = resolve;
|
|
110
|
+
rejectCompletion = reject;
|
|
111
|
+
});
|
|
112
|
+
// Create running execution state
|
|
113
|
+
const execution = {
|
|
114
|
+
state,
|
|
115
|
+
lock,
|
|
116
|
+
externalLock,
|
|
117
|
+
options,
|
|
118
|
+
mutex: new AsyncMutex(),
|
|
119
|
+
aborted: false,
|
|
120
|
+
runningTasks: new Map(),
|
|
121
|
+
completionPromise,
|
|
122
|
+
resolveCompletion,
|
|
123
|
+
rejectCompletion,
|
|
124
|
+
};
|
|
125
|
+
const key = this.executionKey(repo, workspace, executionId);
|
|
126
|
+
this.executions.set(key, execution);
|
|
127
|
+
// Listen for abort signal to persist cancellation immediately.
|
|
128
|
+
// This ensures the "cancelled" status survives even if the process
|
|
129
|
+
// is killed (e.g., repeated Ctrl-C) before the loop can persist.
|
|
130
|
+
if (options.signal) {
|
|
131
|
+
const onAbort = () => {
|
|
132
|
+
execution.aborted = true;
|
|
133
|
+
if (this.stateStore) {
|
|
134
|
+
// Fire-and-forget: best-effort immediate persistence
|
|
135
|
+
void this.stateStore.updateStatus(repo, workspace, executionId, 'cancelled', { error: 'Execution was cancelled' }).catch(() => { });
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
options.signal.addEventListener('abort', onAbort, { once: true });
|
|
139
|
+
}
|
|
140
|
+
// Start the execution loop (non-blocking)
|
|
141
|
+
this.runExecutionLoop(storage, repo, execution).catch(err => {
|
|
142
|
+
rejectCompletion(err);
|
|
143
|
+
});
|
|
144
|
+
return { id: executionId, repo, workspace };
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
// Release lock on initialization failure (if we acquired it)
|
|
148
|
+
if (!externalLock) {
|
|
149
|
+
await lock.release();
|
|
150
|
+
}
|
|
151
|
+
throw err;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async wait(handle) {
|
|
155
|
+
const key = this.executionKey(handle.repo, handle.workspace, handle.id);
|
|
156
|
+
const execution = this.executions.get(key);
|
|
157
|
+
if (!execution) {
|
|
158
|
+
throw new Error(`Execution ${handle.id} not found for workspace '${handle.workspace}'`);
|
|
159
|
+
}
|
|
160
|
+
return execution.completionPromise;
|
|
161
|
+
}
|
|
162
|
+
async getStatus(handle) {
|
|
163
|
+
const key = this.executionKey(handle.repo, handle.workspace, handle.id);
|
|
164
|
+
const execution = this.executions.get(key);
|
|
165
|
+
if (!execution) {
|
|
166
|
+
// Try to read from state store
|
|
167
|
+
if (this.stateStore) {
|
|
168
|
+
const state = await this.stateStore.read(handle.repo, handle.workspace, handle.id);
|
|
169
|
+
if (state) {
|
|
170
|
+
return stateToStatus(state);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
throw new Error(`Execution ${handle.id} not found for workspace '${handle.workspace}'`);
|
|
174
|
+
}
|
|
175
|
+
return stateToStatus(execution.state);
|
|
176
|
+
}
|
|
177
|
+
async cancel(handle) {
|
|
178
|
+
const key = this.executionKey(handle.repo, handle.workspace, handle.id);
|
|
179
|
+
const execution = this.executions.get(key);
|
|
180
|
+
if (!execution) {
|
|
181
|
+
throw new Error(`Execution ${handle.id} not found for workspace '${handle.workspace}'`);
|
|
182
|
+
}
|
|
183
|
+
execution.aborted = true;
|
|
184
|
+
// Persist cancellation immediately so it survives process crashes.
|
|
185
|
+
// The execution loop will also detect the abort and clean up gracefully.
|
|
186
|
+
if (this.stateStore) {
|
|
187
|
+
await this.stateStore.updateStatus(handle.repo, handle.workspace, handle.id, 'cancelled', { error: 'Execution was cancelled' });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async getEvents(handle, sinceSeq) {
|
|
191
|
+
if (!this.stateStore) {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
return this.stateStore.getEventsSince(handle.repo, handle.workspace, handle.id, sinceSeq);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Main execution loop.
|
|
198
|
+
*
|
|
199
|
+
* Uses step functions to execute tasks, managing concurrency and
|
|
200
|
+
* workspace state updates.
|
|
201
|
+
*/
|
|
202
|
+
async runExecutionLoop(storage, repo, execution) {
|
|
203
|
+
const { state, options, mutex } = execution;
|
|
204
|
+
try {
|
|
205
|
+
let hasFailure = false;
|
|
206
|
+
// Check for abort signal from options
|
|
207
|
+
const checkAborted = () => {
|
|
208
|
+
if (options.signal?.aborted && !execution.aborted) {
|
|
209
|
+
execution.aborted = true;
|
|
210
|
+
}
|
|
211
|
+
return execution.aborted;
|
|
212
|
+
};
|
|
213
|
+
while (true) {
|
|
214
|
+
// Check if we're done
|
|
215
|
+
if (execution.runningTasks.size === 0 && stepIsComplete(state)) {
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
// Get ready tasks
|
|
219
|
+
const readyTasks = stepGetReady(state);
|
|
220
|
+
// Launch tasks up to concurrency limit if no failure and not aborted
|
|
221
|
+
const concurrencyLimit = Number(state.concurrency);
|
|
222
|
+
while (!hasFailure &&
|
|
223
|
+
!checkAborted() &&
|
|
224
|
+
readyTasks.length > 0 &&
|
|
225
|
+
execution.runningTasks.size < concurrencyLimit) {
|
|
226
|
+
const taskName = readyTasks.shift();
|
|
227
|
+
const taskState = state.tasks.get(taskName);
|
|
228
|
+
if (!taskState || taskState.status === 'in_progress' || taskState.status === 'completed') {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
// Prepare task (resolve inputs, check cache)
|
|
232
|
+
const prepared = await stepPrepareTask(storage, state, taskName);
|
|
233
|
+
// Check cache
|
|
234
|
+
if (prepared.cachedOutputHash !== null) {
|
|
235
|
+
// Cache hit - handle synchronously within mutex
|
|
236
|
+
await mutex.runExclusive(async () => {
|
|
237
|
+
stepTaskCompleted(state, taskName, prepared.cachedOutputHash, true, 0);
|
|
238
|
+
// Notify callback
|
|
239
|
+
options.onTaskComplete?.({
|
|
240
|
+
name: taskName,
|
|
241
|
+
cached: true,
|
|
242
|
+
state: 'success',
|
|
243
|
+
duration: 0,
|
|
244
|
+
});
|
|
245
|
+
// Update state store (events are added by step function)
|
|
246
|
+
if (this.stateStore) {
|
|
247
|
+
await this.stateStore.update(state);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
// Mark as started (event added by step function)
|
|
253
|
+
stepTaskStarted(state, taskName);
|
|
254
|
+
if (this.stateStore) {
|
|
255
|
+
await this.stateStore.update(state);
|
|
256
|
+
}
|
|
257
|
+
options.onTaskStart?.(taskName);
|
|
258
|
+
// Launch task execution
|
|
259
|
+
const taskPromise = this.executeTask(storage, repo, execution, taskName, prepared).then(async (result) => {
|
|
260
|
+
// Handle task completion within mutex
|
|
261
|
+
await mutex.runExclusive(async () => {
|
|
262
|
+
if (result.state === 'success') {
|
|
263
|
+
const outputPath = parsePathString(prepared.outputPath);
|
|
264
|
+
if (result.outputHash) {
|
|
265
|
+
await workspaceSetDatasetByHash(storage, repo, state.workspace, outputPath, result.outputHash);
|
|
266
|
+
}
|
|
267
|
+
stepTaskCompleted(state, taskName, result.outputHash ?? '', result.cached, result.duration);
|
|
268
|
+
options.onTaskComplete?.({
|
|
269
|
+
name: taskName,
|
|
270
|
+
cached: result.cached,
|
|
271
|
+
state: 'success',
|
|
272
|
+
duration: result.duration,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
hasFailure = true;
|
|
277
|
+
const { result: failedResult } = stepTaskFailed(state, taskName, result.error, result.exitCode, result.duration);
|
|
278
|
+
options.onTaskComplete?.({
|
|
279
|
+
name: taskName,
|
|
280
|
+
cached: false,
|
|
281
|
+
state: result.state === 'failed' ? 'failed' : 'error',
|
|
282
|
+
error: result.error,
|
|
283
|
+
exitCode: result.exitCode,
|
|
284
|
+
duration: result.duration,
|
|
285
|
+
});
|
|
286
|
+
// Skip dependents (events added by step function)
|
|
287
|
+
const skipEvents = stepTasksSkipped(state, failedResult.toSkip, taskName);
|
|
288
|
+
for (const skipEvent of skipEvents) {
|
|
289
|
+
// skipEvents are always task_skipped events
|
|
290
|
+
if (skipEvent.type === 'task_skipped') {
|
|
291
|
+
options.onTaskComplete?.({
|
|
292
|
+
name: skipEvent.value.task,
|
|
293
|
+
cached: false,
|
|
294
|
+
state: 'skipped',
|
|
295
|
+
duration: 0,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// Update state store
|
|
301
|
+
if (this.stateStore) {
|
|
302
|
+
await this.stateStore.update(state);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}).finally(() => {
|
|
306
|
+
execution.runningTasks.delete(taskName);
|
|
307
|
+
});
|
|
308
|
+
execution.runningTasks.set(taskName, taskPromise);
|
|
309
|
+
}
|
|
310
|
+
// Wait for at least one task to complete if we can't launch more
|
|
311
|
+
if (execution.runningTasks.size > 0) {
|
|
312
|
+
await Promise.race(execution.runningTasks.values());
|
|
313
|
+
}
|
|
314
|
+
else if (readyTasks.length === 0 || checkAborted() || hasFailure) {
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// Wait for any remaining tasks
|
|
319
|
+
if (execution.runningTasks.size > 0) {
|
|
320
|
+
await Promise.all(execution.runningTasks.values());
|
|
321
|
+
}
|
|
322
|
+
// Check for abort one final time
|
|
323
|
+
if (checkAborted()) {
|
|
324
|
+
stepCancel(state, 'Execution was aborted');
|
|
325
|
+
if (this.stateStore) {
|
|
326
|
+
await this.stateStore.update(state);
|
|
327
|
+
}
|
|
328
|
+
// Build partial results for abort error
|
|
329
|
+
const partialResults = this.buildPartialResults(state);
|
|
330
|
+
throw new DataflowAbortedError(partialResults);
|
|
331
|
+
}
|
|
332
|
+
// Finalize (event added by step function)
|
|
333
|
+
const { result } = stepFinalize(state);
|
|
334
|
+
if (this.stateStore) {
|
|
335
|
+
await this.stateStore.update(state);
|
|
336
|
+
}
|
|
337
|
+
execution.resolveCompletion(result);
|
|
338
|
+
}
|
|
339
|
+
finally {
|
|
340
|
+
// Release lock if we acquired it
|
|
341
|
+
if (!execution.externalLock) {
|
|
342
|
+
await execution.lock.release();
|
|
343
|
+
}
|
|
344
|
+
// Clean up execution state
|
|
345
|
+
const key = this.executionKey(repo, state.workspace, state.id);
|
|
346
|
+
this.executions.delete(key);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Execute a single task.
|
|
351
|
+
*/
|
|
352
|
+
async executeTask(storage, repo, execution, taskName, prepared) {
|
|
353
|
+
const { options } = execution;
|
|
354
|
+
const startTime = Date.now();
|
|
355
|
+
const execOptions = {
|
|
356
|
+
force: execution.state.force,
|
|
357
|
+
signal: options.signal,
|
|
358
|
+
onStdout: options.onStdout ? (data) => options.onStdout(taskName, data) : undefined,
|
|
359
|
+
onStderr: options.onStderr ? (data) => options.onStderr(taskName, data) : undefined,
|
|
360
|
+
};
|
|
361
|
+
// Use provided runner if available, otherwise call taskExecute directly
|
|
362
|
+
if (options.runner) {
|
|
363
|
+
const result = await options.runner.execute(storage, prepared.taskHash, prepared.inputHashes, execOptions);
|
|
364
|
+
return {
|
|
365
|
+
state: result.state,
|
|
366
|
+
cached: result.cached,
|
|
367
|
+
outputHash: result.outputHash,
|
|
368
|
+
exitCode: result.exitCode,
|
|
369
|
+
error: result.error,
|
|
370
|
+
duration: Date.now() - startTime,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
const result = await taskExecute(storage, repo, prepared.taskHash, prepared.inputHashes, execOptions);
|
|
375
|
+
return {
|
|
376
|
+
state: result.state,
|
|
377
|
+
cached: result.cached,
|
|
378
|
+
outputHash: result.outputHash ?? undefined,
|
|
379
|
+
exitCode: result.exitCode ?? undefined,
|
|
380
|
+
error: result.error ?? undefined,
|
|
381
|
+
duration: Date.now() - startTime,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Build partial results for abort error.
|
|
387
|
+
*/
|
|
388
|
+
buildPartialResults(state) {
|
|
389
|
+
const results = [];
|
|
390
|
+
for (const [name, taskState] of state.tasks) {
|
|
391
|
+
if (taskState.status === 'completed' || taskState.status === 'failed' || taskState.status === 'skipped') {
|
|
392
|
+
// Extract values from Option types
|
|
393
|
+
const cached = taskState.cached.type === 'some' ? taskState.cached.value : false;
|
|
394
|
+
const error = taskState.error.type === 'some' ? taskState.error.value : undefined;
|
|
395
|
+
const exitCode = taskState.exitCode.type === 'some' ? Number(taskState.exitCode.value) : undefined;
|
|
396
|
+
const duration = taskState.duration.type === 'some' ? Number(taskState.duration.value) : 0;
|
|
397
|
+
results.push({
|
|
398
|
+
name,
|
|
399
|
+
cached,
|
|
400
|
+
state: taskState.status === 'completed' ? 'success' : taskState.status,
|
|
401
|
+
error,
|
|
402
|
+
exitCode,
|
|
403
|
+
duration,
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return results;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Generate unique key for an execution.
|
|
411
|
+
*/
|
|
412
|
+
executionKey(repo, workspace, id) {
|
|
413
|
+
return `${repo}::${workspace}:${id}`;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
//# sourceMappingURL=LocalOrchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalOrchestrator.js","sourceRoot":"","sources":["../../../../src/dataflow/orchestrator/LocalOrchestrator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,WAAW,EAA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O,CAAC,IAAI,CAAC;oBACX,IAAI;oBACJ,MAAM;oBACN,KAAK,EAAE,SAAS,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM;oBACtE,KAAK;oBACL,QAAQ;oBACR,QAAQ;iBACT,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,IAAY,EAAE,SAAiB,EAAE,EAAU;QAC9D,OAAO,GAAG,IAAI,KAAK,SAAS,IAAI,EAAE,EAAE,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Orchestrator implementations for dataflow execution.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export * from './interfaces.js';
|
|
11
|
+
export * from './LocalOrchestrator.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dataflow/orchestrator/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Orchestrator implementations for dataflow execution.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export * from './interfaces.js';
|
|
11
|
+
export * from './LocalOrchestrator.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dataflow/orchestrator/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Orchestrator interface for dataflow execution.
|
|
7
|
+
*
|
|
8
|
+
* Abstracts the execution loop, enabling:
|
|
9
|
+
* - LocalOrchestrator: In-process async loop with mutex
|
|
10
|
+
* - StepFunctionsOrchestrator: AWS Step Functions state machine (in e3-aws)
|
|
11
|
+
*/
|
|
12
|
+
import type { StorageBackend, LockHandle } from '../../storage/interfaces.js';
|
|
13
|
+
import type { TaskRunner } from '../../execution/interfaces.js';
|
|
14
|
+
import type { DataflowExecutionState, ExecutionEvent, FinalizeResult } from '../types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Handle to a running dataflow execution.
|
|
17
|
+
*/
|
|
18
|
+
export interface ExecutionHandle {
|
|
19
|
+
/** Unique execution ID (string for UUID support) */
|
|
20
|
+
readonly id: string;
|
|
21
|
+
/** Repository identifier */
|
|
22
|
+
readonly repo: string;
|
|
23
|
+
/** Workspace name */
|
|
24
|
+
readonly workspace: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Status of a dataflow execution (summary view).
|
|
28
|
+
*/
|
|
29
|
+
export interface ExecutionStatus {
|
|
30
|
+
/** Execution ID (string for UUID support) */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Current state */
|
|
33
|
+
state: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
34
|
+
/** Tasks that have completed successfully */
|
|
35
|
+
completed: string[];
|
|
36
|
+
/** Tasks currently running */
|
|
37
|
+
running: string[];
|
|
38
|
+
/** Tasks waiting to run */
|
|
39
|
+
pending: string[];
|
|
40
|
+
/** Tasks that failed */
|
|
41
|
+
failed: string[];
|
|
42
|
+
/** Tasks skipped due to upstream failure */
|
|
43
|
+
skipped: string[];
|
|
44
|
+
/** Error message if state is 'failed' */
|
|
45
|
+
error?: string;
|
|
46
|
+
/** Start time */
|
|
47
|
+
startedAt: Date;
|
|
48
|
+
/** Completion time */
|
|
49
|
+
completedAt?: Date;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Options for starting a dataflow execution.
|
|
53
|
+
*/
|
|
54
|
+
export interface OrchestratorStartOptions {
|
|
55
|
+
/** Maximum concurrent task executions (default: 4) */
|
|
56
|
+
concurrency?: number;
|
|
57
|
+
/** Force re-execution even if cached (default: false) */
|
|
58
|
+
force?: boolean;
|
|
59
|
+
/** Filter to run only specific task(s) by exact name */
|
|
60
|
+
filter?: string;
|
|
61
|
+
/** AbortSignal for cancellation */
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
/** External lock handle (if caller manages locking) */
|
|
64
|
+
lock?: LockHandle;
|
|
65
|
+
/** Task runner for executing individual tasks */
|
|
66
|
+
runner?: TaskRunner;
|
|
67
|
+
/** Callback when a task starts */
|
|
68
|
+
onTaskStart?: (name: string) => void;
|
|
69
|
+
/** Callback when a task completes */
|
|
70
|
+
onTaskComplete?: (result: TaskCompletedCallback) => void;
|
|
71
|
+
/** Callback for task stdout */
|
|
72
|
+
onStdout?: (taskName: string, data: string) => void;
|
|
73
|
+
/** Callback for task stderr */
|
|
74
|
+
onStderr?: (taskName: string, data: string) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Callback data for task completion.
|
|
78
|
+
*/
|
|
79
|
+
export interface TaskCompletedCallback {
|
|
80
|
+
/** Task name */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Whether the task was cached */
|
|
83
|
+
cached: boolean;
|
|
84
|
+
/** Final state */
|
|
85
|
+
state: 'success' | 'failed' | 'error' | 'skipped';
|
|
86
|
+
/** Error message if state is 'error' */
|
|
87
|
+
error?: string;
|
|
88
|
+
/** Exit code if state is 'failed' */
|
|
89
|
+
exitCode?: number;
|
|
90
|
+
/** Duration in milliseconds */
|
|
91
|
+
duration: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Interface for dataflow orchestration.
|
|
95
|
+
*
|
|
96
|
+
* Orchestrators manage the execution loop, calling step functions in sequence
|
|
97
|
+
* and handling concurrency, cancellation, and state persistence.
|
|
98
|
+
*/
|
|
99
|
+
export interface DataflowOrchestrator {
|
|
100
|
+
/**
|
|
101
|
+
* Start a dataflow execution.
|
|
102
|
+
*
|
|
103
|
+
* Acquires the workspace lock (if not provided) and begins execution.
|
|
104
|
+
* Returns immediately with a handle that can be used to monitor progress.
|
|
105
|
+
*
|
|
106
|
+
* @param storage - Storage backend
|
|
107
|
+
* @param repo - Repository identifier
|
|
108
|
+
* @param workspace - Workspace name
|
|
109
|
+
* @param options - Execution options
|
|
110
|
+
* @returns Execution handle
|
|
111
|
+
*
|
|
112
|
+
* @throws {WorkspaceNotFoundError} If workspace doesn't exist
|
|
113
|
+
* @throws {WorkspaceNotDeployedError} If workspace has no package deployed
|
|
114
|
+
* @throws {WorkspaceLockError} If workspace is locked by another process
|
|
115
|
+
*/
|
|
116
|
+
start(storage: StorageBackend, repo: string, workspace: string, options?: OrchestratorStartOptions): Promise<ExecutionHandle>;
|
|
117
|
+
/**
|
|
118
|
+
* Wait for a dataflow execution to complete.
|
|
119
|
+
*
|
|
120
|
+
* Blocks until the execution completes (success, failure, or cancellation).
|
|
121
|
+
*
|
|
122
|
+
* @param handle - Execution handle from start()
|
|
123
|
+
* @returns Final result
|
|
124
|
+
*/
|
|
125
|
+
wait(handle: ExecutionHandle): Promise<FinalizeResult>;
|
|
126
|
+
/**
|
|
127
|
+
* Get the current status of a dataflow execution.
|
|
128
|
+
*
|
|
129
|
+
* @param handle - Execution handle from start()
|
|
130
|
+
* @returns Current status
|
|
131
|
+
*/
|
|
132
|
+
getStatus(handle: ExecutionHandle): Promise<ExecutionStatus>;
|
|
133
|
+
/**
|
|
134
|
+
* Cancel a running dataflow execution.
|
|
135
|
+
*
|
|
136
|
+
* Running tasks will be terminated. The execution will transition to
|
|
137
|
+
* 'cancelled' state.
|
|
138
|
+
*
|
|
139
|
+
* @param handle - Execution handle from start()
|
|
140
|
+
*/
|
|
141
|
+
cancel(handle: ExecutionHandle): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Get events for a dataflow execution since a given sequence number.
|
|
144
|
+
*
|
|
145
|
+
* Used for polling/watching execution progress.
|
|
146
|
+
*
|
|
147
|
+
* @param handle - Execution handle from start()
|
|
148
|
+
* @param sinceSeq - Only return events with seq > sinceSeq
|
|
149
|
+
* @returns Array of events in sequence order
|
|
150
|
+
*/
|
|
151
|
+
getEvents(handle: ExecutionHandle, sinceSeq: number): Promise<ExecutionEvent[]>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Convert execution state to status summary.
|
|
155
|
+
*/
|
|
156
|
+
export declare function stateToStatus(state: DataflowExecutionState): ExecutionStatus;
|
|
157
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/dataflow/orchestrator/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oDAAoD;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