@elaraai/e3-cli 0.0.2-beta.12 → 0.0.2-beta.14
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 +21 -9
- package/dist/src/cli.js +29 -14
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/auth.d.ts +21 -0
- package/dist/src/commands/auth.d.ts.map +1 -0
- package/dist/src/commands/auth.js +185 -0
- package/dist/src/commands/auth.js.map +1 -0
- package/dist/src/commands/get.d.ts.map +1 -1
- package/dist/src/commands/get.js +32 -14
- package/dist/src/commands/get.js.map +1 -1
- package/dist/src/commands/list.d.ts.map +1 -1
- package/dist/src/commands/list.js +47 -14
- package/dist/src/commands/list.js.map +1 -1
- package/dist/src/commands/logs.d.ts.map +1 -1
- package/dist/src/commands/logs.js +126 -54
- package/dist/src/commands/logs.js.map +1 -1
- package/dist/src/commands/package.d.ts.map +1 -1
- package/dist/src/commands/package.js +55 -18
- package/dist/src/commands/package.js.map +1 -1
- package/dist/src/commands/repo.d.ts +29 -0
- package/dist/src/commands/repo.d.ts.map +1 -0
- package/dist/src/commands/repo.js +231 -0
- package/dist/src/commands/repo.js.map +1 -0
- package/dist/src/commands/run.d.ts.map +1 -1
- package/dist/src/commands/run.js +4 -3
- package/dist/src/commands/run.js.map +1 -1
- package/dist/src/commands/set.d.ts.map +1 -1
- package/dist/src/commands/set.js +16 -5
- package/dist/src/commands/set.js.map +1 -1
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +166 -47
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/tree.d.ts.map +1 -1
- package/dist/src/commands/tree.js +110 -16
- package/dist/src/commands/tree.js.map +1 -1
- package/dist/src/commands/watch.d.ts.map +1 -1
- package/dist/src/commands/watch.js +8 -6
- package/dist/src/commands/watch.js.map +1 -1
- package/dist/src/commands/workspace.d.ts +4 -0
- package/dist/src/commands/workspace.d.ts.map +1 -1
- package/dist/src/commands/workspace.js +269 -29
- package/dist/src/commands/workspace.js.map +1 -1
- package/dist/src/credentials.d.ts +123 -0
- package/dist/src/credentials.d.ts.map +1 -0
- package/dist/src/credentials.js +213 -0
- package/dist/src/credentials.js.map +1 -0
- package/dist/src/utils.d.ts +48 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +58 -0
- package/dist/src/utils.js.map +1 -1
- package/package.json +6 -5
- package/dist/src/commands/gc.d.ts +0 -12
- package/dist/src/commands/gc.d.ts.map +0 -1
- package/dist/src/commands/gc.js +0 -44
- package/dist/src/commands/gc.js.map +0 -1
- package/dist/src/commands/init.d.ts +0 -9
- package/dist/src/commands/init.d.ts.map +0 -1
- package/dist/src/commands/init.js +0 -33
- package/dist/src/commands/init.js.map +0 -1
- package/dist/src/commands/status.d.ts +0 -9
- package/dist/src/commands/status.d.ts.map +0 -1
- package/dist/src/commands/status.js +0 -157
- package/dist/src/commands/status.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* e3 repo commands - Repository management
|
|
7
|
+
*/
|
|
8
|
+
import { resolve } from 'path';
|
|
9
|
+
import { rmSync } from 'fs';
|
|
10
|
+
import { repoInit, repoGc, packageList, workspaceList, workspaceGetState, LocalStorage, } from '@elaraai/e3-core';
|
|
11
|
+
import { repoStatus as repoStatusRemote, repoGcStart as repoGcStartRemote, repoGcStatus as repoGcStatusRemote, repoCreate as repoCreateRemote, repoRemoveStart as repoRemoveStartRemote, repoRemoveStatus as repoRemoveStatusRemote, } from '@elaraai/e3-api-client';
|
|
12
|
+
import { some, none } from '@elaraai/east';
|
|
13
|
+
import { parseRepoLocation, formatError, exitError } from '../utils.js';
|
|
14
|
+
import { getValidToken } from '../credentials.js';
|
|
15
|
+
/**
|
|
16
|
+
* Parse repo URL for create command (doesn't validate existence).
|
|
17
|
+
* Returns { type: 'remote', baseUrl, repo } for URLs, or { type: 'local', path } for paths.
|
|
18
|
+
*/
|
|
19
|
+
function parseRepoForCreate(arg) {
|
|
20
|
+
if (arg.startsWith('https://') || arg.startsWith('http://')) {
|
|
21
|
+
const url = new URL(arg);
|
|
22
|
+
const match = url.pathname.match(/^\/repos\/([^/]+)/);
|
|
23
|
+
if (!match) {
|
|
24
|
+
throw new Error(`Invalid remote URL: expected /repos/{repo} in path, got ${url.pathname}`);
|
|
25
|
+
}
|
|
26
|
+
return { type: 'remote', baseUrl: url.origin, repo: match[1] };
|
|
27
|
+
}
|
|
28
|
+
return { type: 'local', path: resolve(arg) };
|
|
29
|
+
}
|
|
30
|
+
export const repoCommand = {
|
|
31
|
+
/**
|
|
32
|
+
* Create a new repository.
|
|
33
|
+
*
|
|
34
|
+
* Local: e3 repo create <path>
|
|
35
|
+
* Remote: e3 repo create <url> (e.g., http://server/repos/name)
|
|
36
|
+
*/
|
|
37
|
+
async create(repoArg) {
|
|
38
|
+
try {
|
|
39
|
+
const location = parseRepoForCreate(repoArg);
|
|
40
|
+
if (location.type === 'remote') {
|
|
41
|
+
const token = await getValidToken(location.baseUrl);
|
|
42
|
+
await repoCreateRemote(location.baseUrl, location.repo, { token });
|
|
43
|
+
console.log(`Created repository: ${location.repo}`);
|
|
44
|
+
console.log(` URL: ${location.baseUrl}/repos/${location.repo}`);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const result = repoInit(location.path);
|
|
48
|
+
if (!result.success) {
|
|
49
|
+
if (result.alreadyExists) {
|
|
50
|
+
exitError(`e3 repository already exists at ${result.repoPath}`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
exitError(`Failed to create repository: ${formatError(result.error)}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
console.log(`Initialized e3 repository at ${result.repoPath}`);
|
|
57
|
+
console.log('');
|
|
58
|
+
console.log('Created:');
|
|
59
|
+
console.log(' objects/ Content-addressable storage');
|
|
60
|
+
console.log(' packages/ Package references');
|
|
61
|
+
console.log(' workspaces/ Workspace state');
|
|
62
|
+
console.log(' executions/ Task execution cache');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
exitError(formatError(err));
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Remove a repository.
|
|
71
|
+
*/
|
|
72
|
+
async remove(locationArg) {
|
|
73
|
+
try {
|
|
74
|
+
const location = await parseRepoLocation(locationArg);
|
|
75
|
+
if (location.type === 'local') {
|
|
76
|
+
// Remove the repository directory
|
|
77
|
+
rmSync(location.path, { recursive: true, force: true });
|
|
78
|
+
console.log(`Removed repository at ${location.path}`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Start async deletion
|
|
82
|
+
const { executionId } = await repoRemoveStartRemote(location.baseUrl, location.repo, { token: location.token });
|
|
83
|
+
console.log('Removing repository...');
|
|
84
|
+
// Poll for completion
|
|
85
|
+
const pollInterval = 500;
|
|
86
|
+
while (true) {
|
|
87
|
+
const status = await repoRemoveStatusRemote(location.baseUrl, location.repo, executionId, { token: location.token });
|
|
88
|
+
if (status.status.type === 'succeeded') {
|
|
89
|
+
console.log(`Removed repository: ${location.repo}`);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (status.status.type === 'failed') {
|
|
93
|
+
const errorMsg = status.error.type === 'some' ? status.error.value : 'Unknown error';
|
|
94
|
+
exitError(`Repo deletion failed: ${errorMsg}`);
|
|
95
|
+
}
|
|
96
|
+
// Still running, wait and poll again
|
|
97
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
exitError(formatError(err));
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Show repository status.
|
|
107
|
+
*/
|
|
108
|
+
async status(locationArg) {
|
|
109
|
+
try {
|
|
110
|
+
const location = await parseRepoLocation(locationArg);
|
|
111
|
+
if (location.type === 'local') {
|
|
112
|
+
const storage = new LocalStorage();
|
|
113
|
+
console.log(`Repository: ${location.path}`);
|
|
114
|
+
console.log('');
|
|
115
|
+
// List packages
|
|
116
|
+
const packages = await packageList(storage, location.path);
|
|
117
|
+
console.log('Packages:');
|
|
118
|
+
if (packages.length === 0) {
|
|
119
|
+
console.log(' (none)');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
for (const pkg of packages) {
|
|
123
|
+
console.log(` ${pkg.name}@${pkg.version}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
console.log('');
|
|
127
|
+
// List workspaces
|
|
128
|
+
const workspaces = await workspaceList(storage, location.path);
|
|
129
|
+
console.log('Workspaces:');
|
|
130
|
+
if (workspaces.length === 0) {
|
|
131
|
+
console.log(' (none)');
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
for (const ws of workspaces) {
|
|
135
|
+
const state = await workspaceGetState(storage, location.path, ws);
|
|
136
|
+
if (state) {
|
|
137
|
+
console.log(` ${ws}`);
|
|
138
|
+
console.log(` Package: ${state.packageName}@${state.packageVersion}`);
|
|
139
|
+
console.log(` Deployed: ${state.deployedAt.toISOString()}`);
|
|
140
|
+
console.log(` Updated: ${state.rootUpdatedAt.toISOString()}`);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
console.log(` ${ws} (not deployed)`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const status = await repoStatusRemote(location.baseUrl, location.repo, { token: location.token });
|
|
150
|
+
console.log(`Repository: ${location.repo}`);
|
|
151
|
+
console.log('');
|
|
152
|
+
console.log(` Objects: ${status.objectCount}`);
|
|
153
|
+
console.log(` Packages: ${status.packageCount}`);
|
|
154
|
+
console.log(` Workspaces: ${status.workspaceCount}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
exitError(formatError(err));
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Run garbage collection.
|
|
163
|
+
*/
|
|
164
|
+
async gc(locationArg, options) {
|
|
165
|
+
try {
|
|
166
|
+
const location = await parseRepoLocation(locationArg);
|
|
167
|
+
const minAge = options.minAge ? parseInt(options.minAge, 10) : 60000;
|
|
168
|
+
if (options.dryRun) {
|
|
169
|
+
console.log('Dry run - no files will be deleted');
|
|
170
|
+
}
|
|
171
|
+
console.log(`Minimum age: ${minAge}ms`);
|
|
172
|
+
console.log('');
|
|
173
|
+
if (location.type === 'local') {
|
|
174
|
+
const storage = new LocalStorage();
|
|
175
|
+
const result = await repoGc(storage, location.path, {
|
|
176
|
+
dryRun: options.dryRun,
|
|
177
|
+
minAge,
|
|
178
|
+
});
|
|
179
|
+
console.log('Garbage collection complete:');
|
|
180
|
+
console.log(` Objects retained: ${result.retainedObjects}`);
|
|
181
|
+
console.log(` Objects deleted: ${result.deletedObjects}`);
|
|
182
|
+
console.log(` Partials deleted: ${result.deletedPartials}`);
|
|
183
|
+
console.log(` Skipped (young): ${result.skippedYoung}`);
|
|
184
|
+
if (result.bytesFreed > 0) {
|
|
185
|
+
const mb = (result.bytesFreed / 1024 / 1024).toFixed(2);
|
|
186
|
+
console.log(` Space reclaimed: ${mb} MB`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
// Start async GC
|
|
191
|
+
const { executionId } = await repoGcStartRemote(location.baseUrl, location.repo, {
|
|
192
|
+
dryRun: options.dryRun ?? false,
|
|
193
|
+
minAge: minAge ? some(BigInt(minAge)) : none,
|
|
194
|
+
}, { token: location.token });
|
|
195
|
+
console.log('Running garbage collection...');
|
|
196
|
+
// Poll for completion
|
|
197
|
+
const pollInterval = 500;
|
|
198
|
+
while (true) {
|
|
199
|
+
const status = await repoGcStatusRemote(location.baseUrl, location.repo, executionId, { token: location.token });
|
|
200
|
+
if (status.status.type === 'succeeded') {
|
|
201
|
+
if (status.stats.type !== 'some') {
|
|
202
|
+
exitError('GC succeeded but no stats returned');
|
|
203
|
+
}
|
|
204
|
+
const result = status.stats.value;
|
|
205
|
+
console.log('');
|
|
206
|
+
console.log('Garbage collection complete:');
|
|
207
|
+
console.log(` Objects retained: ${result.retainedObjects}`);
|
|
208
|
+
console.log(` Objects deleted: ${result.deletedObjects}`);
|
|
209
|
+
console.log(` Partials deleted: ${result.deletedPartials}`);
|
|
210
|
+
console.log(` Skipped (young): ${result.skippedYoung}`);
|
|
211
|
+
if (result.bytesFreed > 0n) {
|
|
212
|
+
const mb = (Number(result.bytesFreed) / 1024 / 1024).toFixed(2);
|
|
213
|
+
console.log(` Space reclaimed: ${mb} MB`);
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
if (status.status.type === 'failed') {
|
|
218
|
+
const errorMsg = status.error.type === 'some' ? status.error.value : 'Unknown error';
|
|
219
|
+
exitError(`GC failed: ${errorMsg}`);
|
|
220
|
+
}
|
|
221
|
+
// Still running, wait and poll again
|
|
222
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (err) {
|
|
227
|
+
exitError(formatError(err));
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=repo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo.js","sourceRoot":"","sources":["../../../src/commands/repo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EACL,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB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,CAAC,cAAc,QAAQ,EAAE,CAAC,CAAC;oBACtC,CAAC;oBAED,qCAAqC;oBACrC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAwEf"}
|
package/dist/src/commands/run.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* e3 run . my-pkg/task ./data.beast2 -o ./out.beast2 --force
|
|
12
12
|
*/
|
|
13
13
|
import { readFile, writeFile } from 'fs/promises';
|
|
14
|
-
import { packageRead, objectWrite, objectRead, taskExecute, } from '@elaraai/e3-core';
|
|
14
|
+
import { packageRead, objectWrite, objectRead, taskExecute, LocalStorage, } from '@elaraai/e3-core';
|
|
15
15
|
import { decodeBeast2 } from '@elaraai/east';
|
|
16
16
|
import { resolveRepo, parsePackageSpec, formatError, exitError } from '../utils.js';
|
|
17
17
|
/**
|
|
@@ -36,6 +36,7 @@ function parseTaskSpec(spec) {
|
|
|
36
36
|
export async function runCommand(repoArg, taskSpec, inputs, options) {
|
|
37
37
|
try {
|
|
38
38
|
const repoPath = resolveRepo(repoArg);
|
|
39
|
+
const storage = new LocalStorage();
|
|
39
40
|
// Parse task specifier
|
|
40
41
|
const { name, version, task } = parseTaskSpec(taskSpec);
|
|
41
42
|
// Validate output is provided
|
|
@@ -43,7 +44,7 @@ export async function runCommand(repoArg, taskSpec, inputs, options) {
|
|
|
43
44
|
exitError('Output file is required. Use -o <path> to specify output.');
|
|
44
45
|
}
|
|
45
46
|
// Get package and find task hash
|
|
46
|
-
const pkg = await packageRead(repoPath, name, version);
|
|
47
|
+
const pkg = await packageRead(storage, repoPath, name, version);
|
|
47
48
|
const taskHash = pkg.tasks.get(task);
|
|
48
49
|
if (!taskHash) {
|
|
49
50
|
const available = Array.from(pkg.tasks.keys()).join(', ');
|
|
@@ -67,7 +68,7 @@ export async function runCommand(repoArg, taskSpec, inputs, options) {
|
|
|
67
68
|
}
|
|
68
69
|
// Execute the task
|
|
69
70
|
const startTime = Date.now();
|
|
70
|
-
const result = await taskExecute(repoPath, taskHash, inputHashes, {
|
|
71
|
+
const result = await taskExecute(storage, repoPath, taskHash, inputHashes, {
|
|
71
72
|
force: options.force,
|
|
72
73
|
});
|
|
73
74
|
const elapsed = Date.now() - startTime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/commands/set.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/commands/set.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiDH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC9B,OAAO,CAAC,IAAI,CAAC,CA6Gf"}
|
package/dist/src/commands/set.js
CHANGED
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
* e3 set . ws.path.to.dataset ./data.east
|
|
11
11
|
* e3 set . ws.path.to.dataset ./data.json --type ".Integer"
|
|
12
12
|
* e3 set . ws.path.to.dataset ./data.csv --type ".Array .Struct [{name: \"name\", type: .String}, {name: \"value\", type: .Integer}]"
|
|
13
|
+
* e3 set https://server/repos/myrepo ws.path.to.dataset ./data.east
|
|
13
14
|
*/
|
|
14
15
|
import { readFile } from 'fs/promises';
|
|
15
16
|
import { extname } from 'path';
|
|
16
|
-
import { WorkspaceLockError, workspaceSetDataset } from '@elaraai/e3-core';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { WorkspaceLockError, workspaceSetDataset, LocalStorage } from '@elaraai/e3-core';
|
|
18
|
+
import { datasetSet as datasetSetRemote } from '@elaraai/e3-api-client';
|
|
19
|
+
import { decodeBeast2, parseFor, fromJSONFor, decodeCsvFor, encodeBeast2For, EastTypeType, parseInferred, toEastTypeValue, } from '@elaraai/east';
|
|
20
|
+
import { parseRepoLocation, parseDatasetPath, formatError, exitError } from '../utils.js';
|
|
19
21
|
/**
|
|
20
22
|
* Parse a type specification in .east format.
|
|
21
23
|
* Types are represented as EastTypeValue variants.
|
|
@@ -38,7 +40,7 @@ function parseTypeSpec(typeSpec) {
|
|
|
38
40
|
*/
|
|
39
41
|
export async function setCommand(repoArg, pathSpec, filePath, options = {}) {
|
|
40
42
|
try {
|
|
41
|
-
const
|
|
43
|
+
const location = await parseRepoLocation(repoArg);
|
|
42
44
|
const { ws, path } = parseDatasetPath(pathSpec);
|
|
43
45
|
if (path.length === 0) {
|
|
44
46
|
exitError('Path must include at least one field (e.g., ws.field)');
|
|
@@ -114,7 +116,16 @@ export async function setCommand(repoArg, pathSpec, filePath, options = {}) {
|
|
|
114
116
|
default:
|
|
115
117
|
exitError(`Unknown file extension: ${ext}. Supported: .beast2, .east, .json, .csv`);
|
|
116
118
|
}
|
|
117
|
-
|
|
119
|
+
if (location.type === 'local') {
|
|
120
|
+
const storage = new LocalStorage();
|
|
121
|
+
await workspaceSetDataset(storage, location.path, ws, path, value, type);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// Remote: encode value to BEAST2 and send
|
|
125
|
+
const encoder = encodeBeast2For(type);
|
|
126
|
+
const beast2Data = encoder(value);
|
|
127
|
+
await datasetSetRemote(location.baseUrl, location.repo, ws, path, beast2Data, { token: location.token });
|
|
128
|
+
}
|
|
118
129
|
console.log(`Set ${pathSpec} from ${filePath}`);
|
|
119
130
|
}
|
|
120
131
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/set.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/set.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,UAAU,IAA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,CAAC,CAAC;YACtC,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,gBAAgB,CACpB,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,IAAI,EACb,EAAE,EACF,IAAI,EACJ,UAAU,EACV,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAC1B,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,QAAQ,SAAS,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,kBAAkB,EAAE,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,oDAAoD,GAAG,CAAC,MAAM,EAAE,GAAG,IAAI,SAAS,EAAE,CAAC,CAAC;YAChG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAClE,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -9,25 +9,31 @@
|
|
|
9
9
|
* e3 start . my-workspace
|
|
10
10
|
* e3 start . my-workspace --concurrency 2
|
|
11
11
|
* e3 start . my-workspace --force
|
|
12
|
+
* e3 start https://server/repos/myrepo my-workspace
|
|
12
13
|
*/
|
|
13
|
-
import { dataflowExecute, DataflowAbortedError, WorkspaceLockError } from '@elaraai/e3-core';
|
|
14
|
-
import {
|
|
14
|
+
import { dataflowExecute, DataflowAbortedError, LocalStorage, WorkspaceLockError } from '@elaraai/e3-core';
|
|
15
|
+
import { dataflowStart as dataflowStartRemote, dataflowExecution as dataflowExecutionRemote, } from '@elaraai/e3-api-client';
|
|
16
|
+
import { parseRepoLocation, formatError, exitError } from '../utils.js';
|
|
17
|
+
/** Polling interval for remote execution (ms) */
|
|
18
|
+
const POLL_INTERVAL = 500;
|
|
15
19
|
/**
|
|
16
20
|
* Execute tasks in a workspace.
|
|
17
21
|
*/
|
|
18
22
|
export async function startCommand(repoArg, ws, options) {
|
|
19
23
|
// Set up abort controller for signal handling
|
|
20
24
|
const controller = new AbortController();
|
|
25
|
+
let aborted = false;
|
|
21
26
|
// Handle SIGINT (Ctrl+C) and SIGTERM gracefully
|
|
22
27
|
const signalHandler = (signal) => {
|
|
23
28
|
console.log('');
|
|
24
29
|
console.log(`Received ${signal}, aborting...`);
|
|
30
|
+
aborted = true;
|
|
25
31
|
controller.abort();
|
|
26
32
|
};
|
|
27
33
|
process.on('SIGINT', () => signalHandler('SIGINT'));
|
|
28
34
|
process.on('SIGTERM', () => signalHandler('SIGTERM'));
|
|
29
35
|
try {
|
|
30
|
-
const
|
|
36
|
+
const location = await parseRepoLocation(repoArg);
|
|
31
37
|
const concurrency = options.concurrency ? parseInt(options.concurrency, 10) : 4;
|
|
32
38
|
console.log(`Starting tasks in workspace: ${ws}`);
|
|
33
39
|
if (options.filter) {
|
|
@@ -38,42 +44,20 @@ export async function startCommand(repoArg, ws, options) {
|
|
|
38
44
|
console.log('Force: re-executing all tasks');
|
|
39
45
|
}
|
|
40
46
|
console.log('');
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
console.log('');
|
|
57
|
-
console.log('Summary:');
|
|
58
|
-
console.log(` Executed: ${result.executed}`);
|
|
59
|
-
console.log(` Cached: ${result.cached}`);
|
|
60
|
-
console.log(` Failed: ${result.failed}`);
|
|
61
|
-
console.log(` Skipped: ${result.skipped}`);
|
|
62
|
-
console.log(` Duration: ${result.duration}ms`);
|
|
63
|
-
if (!result.success) {
|
|
64
|
-
console.log('');
|
|
65
|
-
console.log('Failed tasks:');
|
|
66
|
-
for (const task of result.tasks) {
|
|
67
|
-
if (task.state === 'failed') {
|
|
68
|
-
const exitInfo = task.exitCode != null ? `exit code ${task.exitCode}` : 'spawn failed';
|
|
69
|
-
const errorInfo = task.error ? ` - ${task.error}` : '';
|
|
70
|
-
console.log(` ${task.name}: ${exitInfo}${errorInfo}`);
|
|
71
|
-
}
|
|
72
|
-
else if (task.state === 'error') {
|
|
73
|
-
console.log(` ${task.name}: ${task.error}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
process.exit(1);
|
|
47
|
+
if (location.type === 'local') {
|
|
48
|
+
await executeLocal(location.path, ws, {
|
|
49
|
+
concurrency,
|
|
50
|
+
force: options.force,
|
|
51
|
+
filter: options.filter,
|
|
52
|
+
signal: controller.signal,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
await executeRemote(location.baseUrl, location.repo, ws, {
|
|
57
|
+
concurrency,
|
|
58
|
+
force: options.force,
|
|
59
|
+
filter: options.filter,
|
|
60
|
+
}, location.token, () => aborted);
|
|
77
61
|
}
|
|
78
62
|
}
|
|
79
63
|
catch (err) {
|
|
@@ -94,18 +78,153 @@ export async function startCommand(repoArg, ws, options) {
|
|
|
94
78
|
exitError(formatError(err));
|
|
95
79
|
}
|
|
96
80
|
}
|
|
97
|
-
function
|
|
81
|
+
async function executeLocal(repoPath, ws, options) {
|
|
82
|
+
const storage = new LocalStorage();
|
|
83
|
+
const result = await dataflowExecute(storage, repoPath, ws, {
|
|
84
|
+
concurrency: options.concurrency,
|
|
85
|
+
force: options.force,
|
|
86
|
+
filter: options.filter,
|
|
87
|
+
signal: options.signal,
|
|
88
|
+
onTaskStart: (name) => {
|
|
89
|
+
console.log(` [START] ${name}`);
|
|
90
|
+
},
|
|
91
|
+
onTaskComplete: (taskResult) => {
|
|
92
|
+
printTaskResult(taskResult);
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
printSummary({
|
|
96
|
+
executed: result.executed,
|
|
97
|
+
cached: result.cached,
|
|
98
|
+
failed: result.failed,
|
|
99
|
+
skipped: result.skipped,
|
|
100
|
+
duration: result.duration,
|
|
101
|
+
});
|
|
102
|
+
if (!result.success) {
|
|
103
|
+
printFailedTasks(result.tasks);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function executeRemote(baseUrl, repo, ws, options, token, isAborted) {
|
|
108
|
+
const requestOptions = { token };
|
|
109
|
+
// Start the dataflow execution
|
|
110
|
+
await dataflowStartRemote(baseUrl, repo, ws, {
|
|
111
|
+
concurrency: options.concurrency,
|
|
112
|
+
force: options.force,
|
|
113
|
+
filter: options.filter,
|
|
114
|
+
}, requestOptions);
|
|
115
|
+
// Poll for execution state
|
|
116
|
+
let eventOffset = 0;
|
|
117
|
+
let lastStatus = null;
|
|
118
|
+
while (!isAborted()) {
|
|
119
|
+
const state = await dataflowExecutionRemote(baseUrl, repo, ws, {
|
|
120
|
+
offset: eventOffset,
|
|
121
|
+
}, requestOptions);
|
|
122
|
+
// Print new events
|
|
123
|
+
for (const event of state.events) {
|
|
124
|
+
printEvent(event);
|
|
125
|
+
eventOffset++;
|
|
126
|
+
}
|
|
127
|
+
// Check if execution is done
|
|
128
|
+
if (state.status.type !== 'running') {
|
|
129
|
+
lastStatus = state.status.type;
|
|
130
|
+
// Print summary if available
|
|
131
|
+
if (state.summary.type === 'some') {
|
|
132
|
+
const summary = state.summary.value;
|
|
133
|
+
printSummary({
|
|
134
|
+
executed: Number(summary.executed),
|
|
135
|
+
cached: Number(summary.cached),
|
|
136
|
+
failed: Number(summary.failed),
|
|
137
|
+
skipped: Number(summary.skipped),
|
|
138
|
+
duration: summary.duration,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
// Wait before next poll
|
|
144
|
+
await sleep(POLL_INTERVAL);
|
|
145
|
+
}
|
|
146
|
+
// Handle abort
|
|
147
|
+
if (isAborted()) {
|
|
148
|
+
console.log('');
|
|
149
|
+
console.log('Aborted.');
|
|
150
|
+
process.exit(130);
|
|
151
|
+
}
|
|
152
|
+
// Exit with error if execution failed
|
|
153
|
+
if (lastStatus === 'failed') {
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// =============================================================================
|
|
158
|
+
// Output Formatting
|
|
159
|
+
// =============================================================================
|
|
160
|
+
function printEvent(event) {
|
|
161
|
+
switch (event.type) {
|
|
162
|
+
case 'start':
|
|
163
|
+
console.log(` [START] ${event.value.task}`);
|
|
164
|
+
break;
|
|
165
|
+
case 'complete':
|
|
166
|
+
console.log(` [DONE] ${event.value.task} [${Math.round(event.value.duration)}ms]`);
|
|
167
|
+
break;
|
|
168
|
+
case 'cached':
|
|
169
|
+
console.log(` [CACHED] ${event.value.task}`);
|
|
170
|
+
break;
|
|
171
|
+
case 'failed':
|
|
172
|
+
console.log(` [FAIL] ${event.value.task} [${Math.round(event.value.duration)}ms] (exit code ${event.value.exitCode})`);
|
|
173
|
+
break;
|
|
174
|
+
case 'error':
|
|
175
|
+
console.log(` [ERR] ${event.value.task}: ${event.value.message}`);
|
|
176
|
+
break;
|
|
177
|
+
case 'input_unavailable':
|
|
178
|
+
console.log(` [SKIP] ${event.value.task}`);
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function printTaskResult(result) {
|
|
183
|
+
if (result.cached) {
|
|
184
|
+
console.log(` [CACHED] ${result.name}`);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
98
187
|
switch (result.state) {
|
|
99
188
|
case 'success':
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
189
|
+
console.log(` [DONE] ${result.name} [${Math.round(result.duration)}ms]`);
|
|
190
|
+
break;
|
|
191
|
+
case 'failed': {
|
|
192
|
+
const exitCode = result.exitCode ?? -1;
|
|
193
|
+
console.log(` [FAIL] ${result.name} [${Math.round(result.duration)}ms] (exit code ${exitCode})`);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
103
196
|
case 'error':
|
|
104
|
-
|
|
197
|
+
console.log(` [ERR] ${result.name}: ${result.error ?? 'Unknown error'}`);
|
|
198
|
+
break;
|
|
105
199
|
case 'skipped':
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return '???';
|
|
200
|
+
console.log(` [SKIP] ${result.name}`);
|
|
201
|
+
break;
|
|
109
202
|
}
|
|
110
203
|
}
|
|
204
|
+
function printSummary(summary) {
|
|
205
|
+
console.log('');
|
|
206
|
+
console.log('Summary:');
|
|
207
|
+
console.log(` Executed: ${summary.executed}`);
|
|
208
|
+
console.log(` Cached: ${summary.cached}`);
|
|
209
|
+
console.log(` Failed: ${summary.failed}`);
|
|
210
|
+
console.log(` Skipped: ${summary.skipped}`);
|
|
211
|
+
console.log(` Duration: ${Math.round(summary.duration)}ms`);
|
|
212
|
+
}
|
|
213
|
+
function printFailedTasks(tasks) {
|
|
214
|
+
console.log('');
|
|
215
|
+
console.log('Failed tasks:');
|
|
216
|
+
for (const task of tasks) {
|
|
217
|
+
if (task.state === 'failed') {
|
|
218
|
+
const exitInfo = task.exitCode != null ? `exit code ${task.exitCode}` : 'spawn failed';
|
|
219
|
+
const errorInfo = task.error ? ` - ${task.error}` : '';
|
|
220
|
+
console.log(` ${task.name}: ${exitInfo}${errorInfo}`);
|
|
221
|
+
}
|
|
222
|
+
else if (task.state === 'error') {
|
|
223
|
+
console.log(` ${task.name}: ${task.error}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function sleep(ms) {
|
|
228
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
229
|
+
}
|
|
111
230
|
//# sourceMappingURL=start.js.map
|