[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread Keir Lawson
Change by Keir Lawson : -- nosy: -keirlawson ___ Python tracker <https://bugs.python.org/issue36054> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Keir Lawson
Keir Lawson added the comment: I believe this is related to this ticket: https://bugs.python.org/issue26692 Looking at Java's implementation it seems like they are checking if cgroups are enabled via /proc/self/cgroup and then if it is parsing the cgroup information out of the files

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Keir Lawson
New submission from Keir Lawson : There appears to be no way to detect the number of CPUs allotted to a Python program within a docker container. With the following script: import os print("os.cpu_count(): " + str(os.cpu_count())) print("len(os.sched_getaffinity(0