This document describes the current stable version of Celery (5.7). For development docs, go here.
celery.utils.sysinfo¶
System information utilities.
- celery.utils.sysinfo.AUTO_CONCURRENCY = 'auto'¶
Sentinel string accepted by
worker_concurrency/--concurrencyto request cgroup-aware auto-sizing on Linux.
- class celery.utils.sysinfo.CpuBudget(count: int, available: int, quota: float | None)[source]¶
Result of
cpu_budget().- available: int¶
Affinity-aware CPU count, see
available_cpu_count().
- celery.utils.sysinfo.available_cpu_count() int[source]¶
Return the number of CPUs this process may run on.
Honors the scheduler affinity mask (
taskset, cpusets,docker run --cpuset-cpus) viaos.process_cpu_count()on Python 3.13+ oros.sched_getaffinity()on older Linux. Falls back toos.cpu_count()(or 2 if undetermined) where neither is available.
- celery.utils.sysinfo.cgroup_cpu_quota() float | None[source]¶
Return the CFS CPU quota (in CPUs) that applies to this process.
Walks from the process’s own cgroup (
/proc/self/cgroup, or the mount root when unreadable) up to the root and returns the minimum quota, trying cgroup v2 then v1. None when no quota applies.
- celery.utils.sysinfo.cpu_budget(use_cgroup_quota: bool = True) CpuBudget[source]¶
Return the CPU budget for sizing a worker pool.
Starts from
available_cpu_count(). Whenuse_cgroup_quotais True (CPU-bound pools), caps it toceil(quota)of any cgroup CFS quota, clamped to[1, available].ceilfollows joblib/loky so a fractional quota is fully used; seeworker_concurrency.
- class celery.utils.sysinfo.df(path: str | bytes | PathLike)[source]¶
Disk information.
- property stat: statvfs_result¶