-
Notifications
You must be signed in to change notification settings - Fork 240
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
Fall back to 1 core when # CPUs unavailable #4545
Conversation
I have pulled this in for testing in our branch @tjni What environment do you have where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end of this function we do:
# Return the smaller of the actual thread count and the cgroup's limit, minimum 1.
result = cast(int, max(1, min(min(affinity_size, cgroup_size), total_machine_size)))
So I think if we let total_machine_size
fall back to 1, we won't ever be able to get an answer above 1, even of e.g. os.sched_getaffinity()
is available and working properly.
If we really want to properly support cases where psutil.cpu_count(logical=True)
is unavailable, we need to also change the way we combine the values so that we don't use the CPU count as an upper limit when it's not available.
@tjni Do you want to change they way the values get combined, or should we do it? |
You're correct, I'm sorry I missed that case. I can work on it given that it's my odd environment triggering this corner case, and I'll add a test for this too. My environment is building this package bundled in nixpkgs using the nix package manager. This package manager has a sandbox mode, which prevents access to a lot of system functionality (in my case, it uses the Apple sandbox). This includes access to sysctlbyname unless explicitly allowed. Aside from that, one way to fix this in nixpkgs is just to disable the tests that require going outside of this sandbox, but I noticed from psutil docs that this function could return None so thought it would be nice to fill that gap. |
@tjni Are you still planning to revise this, or should we take over? |
I'm going to close this in favor of the same commits in #4780 from within the repo. |
Changelog Entry
To be copied to the draft changelog by merger:
Reviewer Checklist
issues/XXXX-fix-the-thing
in the Toil repo, or from an external repo.camelCase
that want to be insnake_case
.docs/running/{cliOptions,cwl,wdl}.rst
Merger Checklist