cpu_limit unit discrepancy
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I have a question + potential concern regarding the precision of cpu_limit within the Resources class (line 298 of docker/types/services.py).
According to both this file and the docker-py docs (https://docker-py.readthedocs.io/en/stable/api.html#docker.types.Resources), the cpu_limit of the resources class is in units of 10^9 CPU shares. However, in the code, we have the line:
limits['NanoCPUs'] = cpu_limit
Would it be safe to say, then, that this cpu_limit is actually in units of 10^-9 CPU shares (given the Nano prefix above)? Otherwise, the documentation leads me to think that setting cpu_limit=1 results in allocating 10^9 CPU shares.
Also, would allocating these shares be the same as just specifying the --cpu-shares option in docker?
Please let me know. Thank you.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at line 298 of docker/types/services.py and read the Resources class and its handling of cpu_limit. Compare the code with the linked docker-py API documentation and the Docker Engine meanings of NanoCPUs and --cpu-shares. Done means the units and relationship are resolved and the relevant documentation or code comments are made consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- backend-api-design, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100