Run multi-target commands in parallel (#26)
CI / Lint (eslint) (pull_request) Successful in 27s
CI / Test (jest) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m58s
CI / Integration (api) (pull_request) Successful in 2m49s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m6s
CI / Lint (eslint) (pull_request) Successful in 27s
CI / Test (jest) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m58s
CI / Integration (api) (pull_request) Successful in 2m49s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m6s
- Workflow execute steps send to all targets at once and wait for every result (Promise.all), so one slow or hung worker no longer holds up the rest; any failed target fails the step. parallel: false keeps the old one-at-a-time order, stopping at the first failure, for rolling changes. (Log appends are atomic in SQL, so concurrent targets can't lose entries.) - Quick Command's multi-worker mode sends to every selected worker at once. - Integration tests: 3 workers x 2 s finish in about 2 s; parallel: false takes 6 s or more; one failing target fails the step after all report. - README: the parallel field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06d6c72709
commit
abb4b9326f
4 files changed
+63
-33
No files matched your search
@@ -227,3 +227,32 @@ test('the execution list marks runs waiting on a prompt (#3)', async () => {
|
||||
await waitForExecution(id);
|
||||
expect((await row()).waiting_for_input).toBe(false);
|
||||
});
|
||||
|
||||
test('a step runs on all its targets at once (#26)', async () => {
|
||||
const t0 = Date.now();
|
||||
const ex = await waitForExecution(await start(await createWorkflow([
|
||||
{ id: 'slow', type: 'execute', command: 'sleep 2; echo done', targets: ['all'] },
|
||||
])));
|
||||
expect(ex.status).toBe('completed');
|
||||
expect(outputs(ex).filter(o => o === 'done')).toHaveLength(3);
|
||||
expect(Date.now() - t0).toBeLessThan(5500); // in sequence it would take 6 s or more
|
||||
});
|
||||
|
||||
test('parallel: false runs the targets one after another (#26)', async () => {
|
||||
const t0 = Date.now();
|
||||
const ex = await waitForExecution(await start(await createWorkflow([
|
||||
{ id: 'slow', type: 'execute', command: 'sleep 2; echo done', targets: ['all'], parallel: false },
|
||||
])), { timeout: 30_000 });
|
||||
expect(ex.status).toBe('completed');
|
||||
expect(Date.now() - t0).toBeGreaterThanOrEqual(6000);
|
||||
});
|
||||
|
||||
test('a failure on one target fails the step, after every target has reported (#26)', async () => {
|
||||
const ex = await waitForExecution(await start(await createWorkflow([
|
||||
{ id: 'one-bad', type: 'execute', command: 'test "$WORKER_NAME" != node-02 && echo ok', targets: ['all'] },
|
||||
{ id: 'after', type: 'execute', command: 'echo should-not-run', targets: ['node-01'] },
|
||||
])));
|
||||
expect(ex.status).toBe('failed');
|
||||
expect(outputs(ex).filter(o => o === 'ok')).toHaveLength(2);
|
||||
expect(outputs(ex)).not.toContain('should-not-run');
|
||||
});
|
||||
Reference in new issue
Block a user