cgroup¶
CPU quota of the cgroup of the process.
A container limits its CPUs by a quota of its cgroup, which os.process_cpu_count() does not see: it counts the CPUs of the host. available_cpus is the number of processes a run may use. This module imports only the standard library.
cpu_quota
¶
Get the CPU quota of the cgroup of the process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
the mount of the cgroup file system. |
CGROUP_ROOT
|
proc_cgroup
|
Path
|
the file with the cgroup of the process. |
PROC_CGROUP
|
Returns:
| Type | Description |
|---|---|
int | None
|
The floor of the smallest quota of the cgroup and its parents (cgroup v2) or of its quota (v1), at least 1, |
available_cpus
¶
Get the number of CPUs a run may use: the CPUs of the process bounded by the quota of its cgroup, at least 1.