MACS3.Utilities.Execution
Per-invocation CPU budgets, independent of third-party thread pools.
Resolve at the API/command boundary and pass the immutable policy to consumers. Resource discovery is a snapshot; it never changes affinity or environment.
- class MACS3.Utilities.Execution.CPUAvailability(count, limits, notes)
Bases:
objectDetected whole-CPU capacity and the signals used to obtain it.
- class MACS3.Utilities.Execution.ExecutionPolicy(requested_threads, threads, availability, source='api', requested_process_backend='auto')
Bases:
objectValidated budget including the caller; child processes use B-1 slots.
- MACS3.Utilities.Execution.available_cpus()
Return at least one CPU, tolerating unsupported OS resource queries.
- MACS3.Utilities.Execution.detect_cpu_resources()
Combine host, process, affinity and visible Linux cgroup limits.
- MACS3.Utilities.Execution.resolve_execution_policy(threads=None, process_backend=<object object>, *, execution_policy=None, default_threads=None)
Explicit policy/count wins over MACS3_NUM_THREADS, then default eight.
Supplied policies are never re-resolved, including after environment or resource changes. Explicit conflicting overrides are rejected.