Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modular build builds in concurrent batches #2341

Merged
merged 12 commits into from
Apr 14, 2023

Conversation

cristiano-belloni
Copy link
Contributor

@cristiano-belloni cristiano-belloni commented Apr 13, 2023

Enables batched algorithms for modular build with a custom max concurrency level. Build jobs that can be parallelised are executed in consecutive --concurrencyLevel-long job parallel batches, that are run one after the other until exhaustion. --concurrencyLevel level is a new user option that defaults to the number of logical CPUS in the machine.

This also fixes a bug in modular select where the parallel dependency array can sometimes have holes.


  • Implement batched algo
  • Tests
  • Docs

@changeset-bot
Copy link

changeset-bot bot commented Apr 13, 2023

🦋 Changeset detected

Latest commit: 8ef5627

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
modular-scripts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cristiano-belloni cristiano-belloni changed the base branch from main to feature/v4.3 April 13, 2023 11:55
@coveralls
Copy link
Collaborator

coveralls commented Apr 13, 2023

Coverage Status

Coverage: 39.634% (+0.04%) from 39.59% when pulling 8ef5627 on feature/parallel-builds into 3781ab9 on feature/v4.3.

@cristiano-belloni cristiano-belloni marked this pull request as ready for review April 13, 2023 16:14
@cristiano-belloni cristiano-belloni changed the title Modular batch builds modular build builds in concurrent batches Apr 13, 2023
const concurrency = parseInt(concurrencyLevel, 10);

// If not a number or a negative number, bail out with an error.
if (isNaN(concurrency) || concurrency < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if someone provides a big number? Let's say they typo a couple zeros on the end and put 600. Is this fine or do we need an upper boundary?

Copy link
Contributor Author

@cristiano-belloni cristiano-belloni Apr 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if someone provides a big number? Let's say they typo a couple zeros on the end and put 600. Is this fine or do we need an upper boundary?

It's fine, because:

  1. in practice, the number of things a project can build concurrently at a given stage will be much less than 600 (even if the project has 600 packages, they will be probably interdependent and generate a number of smaller concurrent subsets)
  2. the worst that can happen is that Modular is slow or goes out of memory, in which case the user can just rectify their command

@cristiano-belloni cristiano-belloni merged commit 4d07c4b into feature/v4.3 Apr 14, 2023
@cristiano-belloni cristiano-belloni deleted the feature/parallel-builds branch April 14, 2023 13:22
@github-actions github-actions bot mentioned this pull request Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants