@elaraai/east-node-cli 1.0.83 → 1.0.85
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 +33 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -9
- package/dist/cli.js.map +1 -1
- package/dist/exec.d.ts +17 -21
- package/dist/exec.d.ts.map +1 -1
- package/dist/exec.js +42 -338
- package/dist/exec.js.map +1 -1
- package/dist/exec.spec.js +292 -24
- package/dist/exec.spec.js.map +1 -1
- package/dist/loader.d.ts +86 -42
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +185 -304
- package/dist/loader.js.map +1 -1
- package/dist/loader.spec.js +61 -24
- package/dist/loader.spec.js.map +1 -1
- package/dist/merge.d.ts +5 -1
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +24 -241
- package/dist/merge.js.map +1 -1
- package/dist/runner.d.ts +82 -27
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +136 -68
- package/dist/runner.js.map +1 -1
- package/dist/runner.spec.js +123 -52
- package/dist/runner.spec.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -57,9 +57,10 @@ dict or fold it emits into), and where to write the output and a typed
|
|
|
57
57
|
result: the outcome (`ok`, or `failed` with the message and its source
|
|
58
58
|
locations), the peak memory, and the time spent loading, compiling, executing
|
|
59
59
|
and writing. Paths in a unit may be relative to its file, so a unit and the
|
|
60
|
-
files it names replay wherever they are moved together.
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
files it names replay wherever they are moved together. A run unit says how its
|
|
61
|
+
inputs are read (`decode`, see [How Inputs Are Read](#how-inputs-are-read)). It
|
|
62
|
+
exits 0 when the outcome is `ok` and 1 when the result records a failure; `-v`
|
|
63
|
+
prints where the time went and the peak memory.
|
|
63
64
|
|
|
64
65
|
### Exiting with the Parent
|
|
65
66
|
|
|
@@ -135,6 +136,7 @@ Options:
|
|
|
135
136
|
-p, --package <package> Platform package to load (can be repeated)
|
|
136
137
|
-i, --input <file> Input data file (can be repeated)
|
|
137
138
|
-o, --output <file> Output file path for result
|
|
139
|
+
--decode <mode> How collection inputs are read: lazy (the default) or whole
|
|
138
140
|
-v, --verbose Enable verbose output
|
|
139
141
|
--exit-with-parent Exit as soon as stdin reaches end of file — for a parent
|
|
140
142
|
that holds a stdin pipe it never writes to
|
|
@@ -152,7 +154,7 @@ Arguments:
|
|
|
152
154
|
unit The unit file (.beast2); relative paths in it are relative to its directory
|
|
153
155
|
|
|
154
156
|
Options:
|
|
155
|
-
-v, --verbose Print where the time went and the peak memory
|
|
157
|
+
-v, --verbose Print each input's account, where the time went and the peak memory
|
|
156
158
|
--exit-with-parent Exit as soon as stdin reaches end of file
|
|
157
159
|
```
|
|
158
160
|
|
|
@@ -212,22 +214,40 @@ Options:
|
|
|
212
214
|
| `.east` | Text East format |
|
|
213
215
|
| `.json` | JSON format |
|
|
214
216
|
|
|
215
|
-
##
|
|
217
|
+
## How Inputs Are Read
|
|
218
|
+
|
|
219
|
+
Indexed `.beast2` collection inputs (Array/Set/Dict) open **lazily**, whatever
|
|
220
|
+
they weigh: size, iteration and keyed reads are served from the blob's segment
|
|
221
|
+
index with O(segment) decoded memory, and any other operation transparently
|
|
222
|
+
decodes the whole value once. A loop holds only the segment it walks. Keyed
|
|
223
|
+
reads keep the segments they decode, up to 256 MiB of decoded weight per input
|
|
224
|
+
(`EAST_PAGED_CACHE_BYTES`; `1` keeps one segment), and reads in key order keep
|
|
225
|
+
about two. `--decode whole` decodes every input before the program runs
|
|
226
|
+
instead, which suits a program that reads at random across more than that, or
|
|
227
|
+
loops over an input more than once: lazily, a read beyond the segments the
|
|
228
|
+
pager keeps decodes its segment again. `exec` reads the same choice from its
|
|
229
|
+
unit's `decode`, and east-c and east-py take it alike. Semantics are identical
|
|
230
|
+
either way: it is a memory and time choice, not a behavior toggle.
|
|
216
231
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
operation transparently decodes the whole value once. Semantics are identical
|
|
221
|
-
to an eager decode, so the threshold is a memory knob, not a behavior toggle.
|
|
232
|
+
```bash
|
|
233
|
+
east-node run ./lookup.beast2 -p @elaraai/east-node-std -i table.beast2 --decode whole
|
|
234
|
+
```
|
|
222
235
|
|
|
223
|
-
|
|
224
|
-
|
|
236
|
+
With `-v` the runner says how each input opened, what a lazy input's reads came
|
|
237
|
+
to, and what an input decoded whole holds in memory — the growth in resident
|
|
238
|
+
memory across its decode, beside what it weighs on disk, since a nested
|
|
239
|
+
collection decodes at many times that. A lazy input's reads come to the
|
|
240
|
+
segments they decoded of its segments and the fences they probed, and the bytes
|
|
241
|
+
they read; when an operation the pager cannot serve decoded it whole, to the
|
|
242
|
+
resident memory that added; and when they decoded segments again, to how many
|
|
243
|
+
decodes of how many segments, since decoding the input whole would decode each
|
|
244
|
+
once. east-c and east-py say each in the same words, but for the bytes read.
|
|
225
245
|
|
|
226
246
|
A collection input may also be a manifest directory, the form e3 stages a
|
|
227
247
|
stored collection in: the input file holds a manifest, and each segment it
|
|
228
248
|
names is a standalone blob in `<file>.segments/<sha256>.beast2`. It opens
|
|
229
249
|
over those files — lazily, a read opening only the segments it reaches, or
|
|
230
|
-
whole — and
|
|
250
|
+
whole — and weighs its segments in the `-v` account.
|
|
231
251
|
|
|
232
252
|
Inputs open **frozen** — a frozen value cannot be mutated, and a frozen
|
|
233
253
|
collection compares by value — so a lazy open serves every element shape but
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuSH,wBAAgB,IAAI,IAAI,IAAI,CA0F3B"}
|
package/dist/cli.js
CHANGED
|
@@ -9,14 +9,30 @@ import { createRequire } from 'module';
|
|
|
9
9
|
import { EastError } from '@elaraai/east/internal';
|
|
10
10
|
import { loadPlatforms, loadPlatformWithMetadata } from './loader.js';
|
|
11
11
|
import { printResult, runProgram, UsageError } from './runner.js';
|
|
12
|
-
import {
|
|
12
|
+
import { execUnit, readUnit } from './exec.js';
|
|
13
13
|
import { encodeRebuilt, isDirectory, transpile, transpileDir } from './transpile.js';
|
|
14
14
|
import { exportFunctionsFromModule } from './export-functions.js';
|
|
15
15
|
import { serve as serveLsp } from './lsp.js';
|
|
16
16
|
import { checkModule, formatFinding } from './check.js';
|
|
17
|
-
import { East, UnitResultType, encodeBeast2For } from '@elaraai/east';
|
|
17
|
+
import { East, UnitResultType, encodeBeast2For, variant } from '@elaraai/east';
|
|
18
18
|
const require = createRequire(import.meta.url);
|
|
19
19
|
const pkg = require('../package.json');
|
|
20
|
+
/** The `--decode` flag's help: how `run` reads its collection inputs, the
|
|
21
|
+
* choice `exec` reads from its unit. */
|
|
22
|
+
const DECODE_HELP = 'How collection inputs are read: lazy (the default) opens each over its file and decodes a segment as the program ' +
|
|
23
|
+
'reads it; whole decodes every input before the program runs';
|
|
24
|
+
/**
|
|
25
|
+
* The `--decode` flag's value as the unit's `decode` says it, or `null` when
|
|
26
|
+
* it names neither lazy nor whole.
|
|
27
|
+
*
|
|
28
|
+
* @param mode - the flag's value; absent means lazy
|
|
29
|
+
* @returns how the inputs are read
|
|
30
|
+
*/
|
|
31
|
+
function decodeOf(mode) {
|
|
32
|
+
if (mode === undefined || mode === 'lazy')
|
|
33
|
+
return variant('lazy', null);
|
|
34
|
+
return mode === 'whole' ? variant('whole', null) : null;
|
|
35
|
+
}
|
|
20
36
|
/**
|
|
21
37
|
* Collects a repeated option's values.
|
|
22
38
|
*
|
|
@@ -103,8 +119,12 @@ async function cmdRun(irFile, options) {
|
|
|
103
119
|
return fail('Error: At least one platform package is required.\n' +
|
|
104
120
|
'Example: east-node run program.beast2 -p @elaraai/east-node-std');
|
|
105
121
|
}
|
|
122
|
+
const decode = decodeOf(options.decode);
|
|
123
|
+
if (decode === null) {
|
|
124
|
+
return fail(`Error: --decode takes lazy or whole, not ${options.decode}`);
|
|
125
|
+
}
|
|
106
126
|
const platformFns = await loadPlatforms(packages);
|
|
107
|
-
await runProgram(irFile, platformFns, packages, options.input ?? [], options.output, options.verbose ?? false);
|
|
127
|
+
await runProgram(irFile, platformFns, packages, options.input ?? [], options.output, options.verbose ?? false, decode);
|
|
108
128
|
}
|
|
109
129
|
catch (err) {
|
|
110
130
|
// A plain (non-East) error — e.g. one thrown by a custom platform
|
|
@@ -134,9 +154,9 @@ async function cmdExec(unitPath, options) {
|
|
|
134
154
|
startLifeline(options);
|
|
135
155
|
let result;
|
|
136
156
|
try {
|
|
137
|
-
const
|
|
138
|
-
result = await
|
|
139
|
-
writeFileSync(
|
|
157
|
+
const unit = readUnit(unitPath);
|
|
158
|
+
result = await execUnit(unit, options.verbose ?? false);
|
|
159
|
+
writeFileSync(unit.result, encodeBeast2For(UnitResultType)(result));
|
|
140
160
|
}
|
|
141
161
|
catch (err) {
|
|
142
162
|
return fail(`Error: exec ${unitPath}: ${err.message ?? String(err)}`, 2);
|
|
@@ -245,16 +265,18 @@ export function main() {
|
|
|
245
265
|
.option('-p, --package <package>', 'Platform package to load (can be repeated)', collect, [])
|
|
246
266
|
.option('-i, --input <file>', 'Input data file (can be repeated, order matches function parameters)', collect, [])
|
|
247
267
|
.option('-o, --output <file>', 'Output file path for result')
|
|
268
|
+
.option('--decode <mode>', DECODE_HELP)
|
|
248
269
|
.option('-v, --verbose', 'Enable verbose output')
|
|
249
270
|
.option('--exit-with-parent', EXIT_WITH_PARENT_HELP)
|
|
250
271
|
.action(cmdRun);
|
|
251
272
|
program
|
|
252
273
|
.command('exec')
|
|
253
274
|
.description('Execute a unit, the runner protocol: run a program, or merge the parts of an output, as the unit file ' +
|
|
254
|
-
'says, write the output by its kind and record the result; exit 0 when it is ok and 1 when it failed'
|
|
275
|
+
'says, write the output by its kind and record the result; exit 0 when it is ok and 1 when it failed. A run ' +
|
|
276
|
+
"unit's inputs are read as its `decode` says")
|
|
255
277
|
.argument('<unit>', 'The unit file (.beast2); relative paths in it are relative to its directory')
|
|
256
|
-
.option('-v, --verbose', 'Print each input — what it weighs, whether it opened lazily
|
|
257
|
-
'where the time went, and the peak memory')
|
|
278
|
+
.option('-v, --verbose', 'Print each input — what it weighs, whether it opened lazily or was decoded whole and what ' +
|
|
279
|
+
'reading it came to — where the time went, and the peak memory')
|
|
258
280
|
.option('--exit-with-parent', EXIT_WITH_PARENT_HELP)
|
|
259
281
|
.action(cmdExec);
|
|
260
282
|
program
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CA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EAAE,OAAO,EAAE,EAAE,CAAC;SAC7F,MAAM,CAAC,UAAU,CAAC,CAAC;IAExB,OAAO,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC"}
|
package/dist/exec.d.ts
CHANGED
|
@@ -3,39 +3,35 @@
|
|
|
3
3
|
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
5
|
import { type Unit, type UnitResult } from '@elaraai/east';
|
|
6
|
-
/** Resolves a path a unit names. */
|
|
7
|
-
type Resolve = (path: string) => string;
|
|
8
|
-
/** A unit read from its file, and how to find what it names. */
|
|
9
|
-
export interface ReadUnit {
|
|
10
|
-
/** The unit, as its file holds it. */
|
|
11
|
-
unit: Unit;
|
|
12
|
-
/** Resolves a path the unit names: a relative one against the unit file's
|
|
13
|
-
* directory, so a unit and the files it names move together. */
|
|
14
|
-
at: Resolve;
|
|
15
|
-
}
|
|
16
6
|
/**
|
|
17
|
-
* Reads a unit file
|
|
7
|
+
* Reads a unit file, naming every file the unit names by the path it is at: a
|
|
8
|
+
* relative one resolved against the unit file's directory, so a unit and the
|
|
9
|
+
* files it names move together.
|
|
18
10
|
*
|
|
19
11
|
* @param unitPath - the unit file
|
|
20
|
-
* @returns the unit,
|
|
12
|
+
* @returns the unit, its paths resolved
|
|
21
13
|
* @throws {Error} When the file cannot be read or does not hold a unit.
|
|
22
14
|
*/
|
|
23
|
-
export declare function readUnit(unitPath: string):
|
|
15
|
+
export declare function readUnit(unitPath: string): Unit;
|
|
24
16
|
/**
|
|
25
|
-
* Executes a unit: does its work, writes its output,
|
|
17
|
+
* Executes a unit over this machine's files: does its work, writes its output,
|
|
18
|
+
* and reports how it went.
|
|
26
19
|
*
|
|
27
|
-
* @param
|
|
20
|
+
* @param unit - the unit, its paths resolved ({@link readUnit})
|
|
28
21
|
* @param verbose - print, on stderr, the account of each input `run -v`
|
|
29
|
-
* prints — its file and what it weighs, whether it opened lazily
|
|
30
|
-
* reading it came to — which is what reaches a
|
|
22
|
+
* prints — its file and what it weighs, whether it opened lazily or was
|
|
23
|
+
* decoded whole, and what reading it came to — which is what reaches a
|
|
24
|
+
* task's log
|
|
31
25
|
* @returns the result — a failure is its outcome, never a throw
|
|
32
26
|
*
|
|
33
27
|
* @remarks
|
|
34
28
|
* The unit's thread grant caps the frame pool for the rest of the process: a
|
|
35
29
|
* grant of one frames every output inline. A unit whose host places its
|
|
36
|
-
* segments as they are read (`fetch`)
|
|
37
|
-
*
|
|
30
|
+
* segments as they are read (`fetch`) turns on {@link FETCH_SEGMENTS_ENV} for
|
|
31
|
+
* the process, and has a segment of a staged manifest that is absent asked for
|
|
32
|
+
* as it is first read. A lazy input's pager keeps the segments keyed and index
|
|
33
|
+
* reads decode, up to `EAST_PAGED_CACHE_BYTES` of decoded weight
|
|
34
|
+
* ({@link pagedCacheBytes}).
|
|
38
35
|
*/
|
|
39
|
-
export declare function
|
|
40
|
-
export {};
|
|
36
|
+
export declare function execUnit(unit: Unit, verbose?: boolean): Promise<UnitResult>;
|
|
41
37
|
//# sourceMappingURL=exec.d.ts.map
|
package/dist/exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,OAAO,EAA8D,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAKvH;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAW/E"}
|