4 ms·
Starting from Python 3.13 there should be a new method os.process_cpu_count() that aims to get the actually available number of cores our process can run on.
by mihaic 3y ago
Starting from Python 3.13 there should be a new method os.process_cpu_count() that aims to get the actually available number of cores our process can run on.
- itamarst 3y agoNeat! Unfortunately at the moment it still ignores cgroups, it's just a wrapper around sched_getaffinity(). https://github.com/python/cpython/blob/6a69b80d1b1f3987fcec3300c5dc879c6e965079/Lib/os.py#L1143 https://github.com/python/cpython/blob/6a69b80d1b1f3987fcec3...
- mihaic 3y agoTrue, I'm wondering if they might change the implementation for this actually, since the function name is pretty agnostic.