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

2021-10-11 Thread Dong-hee Na


Dong-hee Na  added the comment:

> There is IBM effort to do this in container level, so that os.cpu_count() 
> will return right result in container

Good news!

--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2021-10-11 Thread Vadym Stupakov


Vadym Stupakov  added the comment:

> Do we have any news about this?

There is IBM effort to do this in container level, so that os.cpu_count() will 
return right result in container

https://www.phoronix.com/scan.php?page=news_item=Linux-CPU-Namespace

--
nosy: +RedEyed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-04-19 Thread Tigran


Tigran  added the comment:

Do we have any news about this?

--
nosy: +nargit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-26 Thread STINNER Victor


STINNER Victor  added the comment:

> Hello guys,

Please try to find a more inclusive way to say hello: https://heyguys.cc/ ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-26 Thread Manjusaka


Manjusaka  added the comment:

Hello guys, I some ideas about this issue

First, maybe we should add a new API named cpu_usable_count(). I think it's 
more meaningful than the os.sched_getaffinity(0)

Second, more and more people use docker to run their app today. So people need 
an official way to get the environment info, not just cpu, but the memory,  the 
network traffic limit. Because the docker is based on the CGroup in Linux, 
maybe we can add a cgroup lib as an official supported lib.

but I'm not sure about this idea, because there are some problem.

1. the CGroup is only supported on Linux. I'm not sure that adding a 
platform-specific lib is a good idea

2. Many languages are not adding cgroup official yet. Maybe there are some 
languages are optimized for the cgroup (such as Java in JVM)

--
nosy: +giampaolo.rodola

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

Actually, we already have some third party libs to support cgroup. But most of 
them get these questions

1. They are not std lib

2. They are just support cgroup1

But if we want to add a new std lib. Should we create a PEP?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-23 Thread Christian Heimes


Christian Heimes  added the comment:

I suggest that your provide a low solution that returns general information 
from cgroup v1 and unified cgroup v2 rather than a solution that focuses on CPU 
only. Then you can provide a high level interface that returns effective CPU 
cores.

cgroup v2 (unified hierarchy) has been around for 6 years and slowly gains 
traction as container platforms start to support them.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure that it's a good idea to change os.cpucount(). I suggest to add a 
new function instead.

os.cpu_count() iss documented as:
"Return the number of CPUs in the system."
https://docs.python.org/dev/library/os.html#os.cpu_count

By the way, the documentation adds:

"This number is not equivalent to the number of CPUs the current process can 
use. The number of usable CPUs can be obtained with 
len(os.sched_getaffinity(0))"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

I will make a PR in this week

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

Hello Mike, thanks for your code. 

I think it's a good way 

I think if  cpu.quota and cpu.shares are -1, just return the original value in 
os.cpu_count() is OK

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-12-11 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-11-20 Thread Galen Han


Change by Galen Han :


--
nosy: +Galen Han

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-10-01 Thread STINNER Victor


Change by STINNER Victor :


--
title: Way to detect CPU count inside docker container -> On Linux, os.count() 
should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com