feat: add --ordered option to run command - #1989
Open
vjymisal0 wants to merge 1 commit into
Open
Conversation
Adds an `ordered` option to `aegir run` (default `true`, preserving current behaviour). When set to `false`, scripts are started for every project as soon as a concurrency slot is free, instead of waiting for a project's sibling dependencies to finish first. This is useful for scripts like `test` where running in dependency order isn't required and only adds unnecessary latency. Fixes ipfs#1500
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1500
Adds an
orderedoption toaegir run(defaulttrue, preserving current behaviour). When set tofalse, scripts are started for every project as soon as a concurrency slot is free, instead of waiting for a project's sibling dependencies to finish first.This is useful for scripts like
testwhere running in dependency order isn't required and only adds unnecessary latency, as noted in the issue.Changes
src/types.ts: addordered?: booleantoRunOptionssrc/config/user.js: defaultrun.orderedtotruesrc/cmds/run.js: add--ordered/--no-orderedCLI flagsrc/run.js: forwardctx.orderedtoeveryMonorepoProjectsrc/utils.js: whenopts.ordered === false,everyMonorepoProjectskips the dependency in-degree bookkeeping and queues every project immediately (still bounded byconcurrency)test/run.js: add a test proving that with--no-ordereda downstream project (d) starts before its dependency (a) finishes, using the existinga-large-monorepofixtureTest plan
test/run.js(should execute commands without waiting for dependencies with --no-ordered) that fails against the old code (dependency order enforced) and passes with the fix.aegir lint(eslint + tsc) passes locally on the changed files.everyMonorepoProjectdirectly against thea-large-monorepofixture: withordered: trueprojectdonly starts afterafinishes; withordered: falseit starts immediately alongsidea,b, andc.Note: I could not run the full Mocha
test/run.jssuite end-to-end locally since it is skipped on Windows (os.platform() === 'win32') due to a pre-existing symlink-based fixture setup unrelated to this change; I validated the new logic directly against the same fixture instead, as described above.