[issue36054] Way to detect CPU count inside docker container

2019-10-01 Thread Mike
Mike added the comment: Is this issue still being worked on as a core feature? I needed a solution for this using 2.7.11 to enable some old code to work properly/nicely in a container environment on AWS Batch and was forced to figure out what OpenJDK was doing and came up with a solution.

[issue36054] Way to detect CPU count inside docker container

2019-04-18 Thread Joshua Bronson
Change by Joshua Bronson : -- nosy: +jab ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36054] Way to detect CPU count inside docker container

2019-04-04 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: >Yes, not only but also support get real memory limit. > >look at >https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits Yep, but in this case, you have to create an other issue for the memory limit. --

[issue36054] Way to detect CPU count inside docker container

2019-04-03 Thread Manjusaka
Manjusaka added the comment: Yes, not only but also support get real memory limit. look at https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits -- ___ Python tracker

[issue36054] Way to detect CPU count inside docker container

2019-04-03 Thread Christian Heimes
Christian Heimes added the comment: The JVM parses cgroups information from the proc filesystem and evaluates CPU count from the cgroup cpu.shares and cpu.cfs. https://github.com/openjdk/jdk/blob/d5686b87f31d6c57ec6b3e5e9c85a04209dbac7a/src/hotspot/os/linux/os_linux.cpp#L5304-L5336

[issue36054] Way to detect CPU count inside docker container

2019-04-03 Thread Manjusaka
Manjusaka added the comment: Hi Stéphane: I have checked the JVM implantation about container improvements. I confirm that maybe we need a new Libary for container environment. I don't think that combine it into the os module is a good idea. I will make a PR during this week. --

[issue36054] Way to detect CPU count inside docker container

2019-03-24 Thread Manjusaka
Manjusaka added the comment: Hi Stéphane Thanks a lot! In my opinion, I would like to make an independent library that name is cgroups. For ease of use and compatibility, I think it's better than combining code with the os module. Thanks for you working! Manjusaka --

[issue36054] Way to detect CPU count inside docker container

2019-03-24 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Hi Manjusaka, Could you explain your solution, because I have read the code of openjdk, (C++) and I am going to be honnest, it was not complex but not really clear. Also, if you need my help for the review or for the construction of your PR, I can help you.

[issue36054] Way to detect CPU count inside docker container

2019-03-24 Thread Manjusaka
Manjusaka added the comment: I think that I may work on a PR for this issue. Is there anybody has worked on it ? -- nosy: +Manjusaka ___ Python tracker ___

[issue36054] Way to detect CPU count inside docker container

2019-03-24 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: I am really sorry but I thought to work on this issue but it's not the case. Feel free to submit a PR. -- components: +Interpreter Core versions: +Python 3.8 ___ Python tracker

[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 filesystem.

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: ok, I didn't see your test with openjdk:10, sorry -- ___ Python tracker ___ ___ Python-bugs-list

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: so, I have also tested with the last docker image of golang. > docker run --rm --cpus 1 -it golang /bin/bash here is the code of golang: package main import "fmt" import "runtime" func main() { cores := runtime.NumCPU() fmt.Printf("This

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: I would like to work on this issue. -- nosy: +matrixise ___ Python tracker ___ ___

[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)): " +