@genroc/eval-node 0.0.0-edge.18996ebb → 0.0.0-edge.18b82d4b
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 +1 -1
- package/dist/worker.js +3 -3
- package/package.json +1 -1
- package/worker.ts +4 -4
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ The worker connects to genroc, not the other way round, so it only needs outboun
|
|
|
88
88
|
| env | default | |
|
|
89
89
|
|---|---|---|
|
|
90
90
|
| `GENROC_SERVER` | `http://localhost:8448` | the genroc server |
|
|
91
|
-
| `GENROC_TOKEN` / `GENROC_TOKEN_FILE` | *(none)* | token, or a file holding it, when the server uses `--auth
|
|
91
|
+
| `GENROC_TOKEN` / `GENROC_TOKEN_FILE` | *(none)* | token, or a file holding it, when the server uses `--auth` |
|
|
92
92
|
| `PROCESS` / `TASK` | `script-node` / `eval_node` | the process and task id this worker claims; the defaults are script-node's. Set `PROCESS` for a renamed copy. Neither may be empty. |
|
|
93
93
|
| `CONCURRENCY` | `4` | scripts run at once |
|
|
94
94
|
| `LEASE_MS` | `30000` | claim lease, renewed every third of it |
|
package/dist/worker.js
CHANGED
|
@@ -166,9 +166,9 @@ async function answer(token, outcome) {
|
|
|
166
166
|
await release(token);
|
|
167
167
|
}
|
|
168
168
|
async function run(job, signal) {
|
|
169
|
-
// The task's own timeout is the script's budget
|
|
170
|
-
// objects below spends the same deadline.
|
|
171
|
-
const due = job.
|
|
169
|
+
// The task's own timeout is the script's budget, moved onto the monotonic clock so a wall-clock
|
|
170
|
+
// step mid-run cannot stretch it. Fetching the objects below spends the same deadline.
|
|
171
|
+
const due = job.deadline === undefined ? undefined : performance.now() + (Date.parse(job.deadline) - Date.now());
|
|
172
172
|
let resolved;
|
|
173
173
|
try {
|
|
174
174
|
resolved = await resolveObjects(job);
|
package/package.json
CHANGED
package/worker.ts
CHANGED
|
@@ -42,7 +42,7 @@ type QueueTask = {
|
|
|
42
42
|
task: string;
|
|
43
43
|
external_input: unknown;
|
|
44
44
|
objects?: ObjectEntry[];
|
|
45
|
-
|
|
45
|
+
deadline?: string;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// Large values arrive as refs; a bundle is one object per definition version, fetched once.
|
|
@@ -188,9 +188,9 @@ async function answer(token: string, outcome: Record<string, unknown>): Promise<
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
async function run(job: QueueTask, signal: AbortSignal): Promise<void> {
|
|
191
|
-
// The task's own timeout is the script's budget
|
|
192
|
-
// objects below spends the same deadline.
|
|
193
|
-
const due = job.
|
|
191
|
+
// The task's own timeout is the script's budget, moved onto the monotonic clock so a wall-clock
|
|
192
|
+
// step mid-run cannot stretch it. Fetching the objects below spends the same deadline.
|
|
193
|
+
const due = job.deadline === undefined ? undefined : performance.now() + (Date.parse(job.deadline) - Date.now());
|
|
194
194
|
let resolved: unknown;
|
|
195
195
|
try {
|
|
196
196
|
resolved = await resolveObjects(job);
|