Skip to content

CI Limit ninja number of parallel jobs in CircleCI #30333

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

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Nov 22, 2024

Check this fixes the CircleCI issue see in many PRs for example in #30327 (comment).

Not sure why this started being an issue, my guess is that something changed in CircleCI and ninja thinks he has too many cores instead of the 2 that it should see. ninja ends up creating too many processes and there is some kind of CircleCI job manager that kills the processes. This corroborates what was seen using CircleCI SSH debug with htop.

Apparently the default number of jobs is number of cores + 2 so I set it to 4 since we have two cores in our CircleCI job. Not sure the rule is so simple after reading a bit more but -j4 makes the doc build pass so probably good enough.

There was this old ninja+CircleCI issue ninja-build/ninja#1530 although I am guessing this is not fully relevant ninja-build/ninja#1530. At least this points to https://github.com/ninja-build/ninja/blob/a3fda2b06c027f19c7ec68c08e21859e44c15cde/src/ninja.cc#L248-L258 that seems to point at the default parallelism rule. TL;DR in general parallelism is number of cores + 2, 3 for 2 cores and 2 for 1 core.

Copy link

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: ca75432. Link to the linter CI: here

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM since it worked when we connected in SSH.

@glemaitre glemaitre enabled auto-merge (squash) November 22, 2024 17:02
@glemaitre
Copy link
Member

Enabling auto-merge. This is indeed fixing the issue.

@glemaitre glemaitre merged commit 90a51c1 into scikit-learn:main Nov 22, 2024
38 checks passed
@lesteve lesteve deleted the fix-circleci branch November 22, 2024 17:18
@lesteve
Copy link
Member Author

lesteve commented Nov 25, 2024

For completeness, it looks like ninja does not know how to use cgroups v2 ninja-build/ninja#2166. This is the reason ninja was seeing something like 36 cores instead of 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants