Recently os.cpu_count() on Windows has been fixed in order to take process
groups into account and return the number of all available CPUs:
This made me realize that os.cpu_count() does not return the number of
*usable* CPUs, which could possibly represent a better default value for
things like multiprocessing and process pools.
It is currently possible to retrieve this info on UNIX with
len(os.sched_getaffinity(0)) which takes CPU affinity and (I think) Linux
cgroups into account, but it's not possible to do the same on Windows which
provides this value via GetActiveProcessorCount() API.
As such I am planning to implement this in psutil but would like to know
how python-ideas feels about adding a new os.usable_cpu_count() function
(or having os.cpu_count(usable=True)).
Giampaolo - http://grodola.blogspot.com
For large archives, I want to display a progress bar while the archive
is being extracted with:
I could write my own version of extractall() to do this, or maybe we
could introduce a callback option that gets called
everytime .extract() is called in extractall()
The callback can receive the tarinfo object and where it's being
extracted. This is enough to plug a progress bar
and avoid reinventing .extractall()
I can add a ticket and maybe a patch if people think this is a good
Tarek Ziadé | coding: https://ziade.org | running: https://foule.es |