Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nano_cpus parameter in the docker_container.py file. #38063

Closed
wants to merge 1 commit into from

Conversation

amolkahat
Copy link
Contributor

@amolkahat amolkahat commented Mar 28, 2018

SUMMARY

Added nano_cpus parameter in the docker_container.py file.

Fixes: #34320

Signed-off-by: Amol Kahat akahat@redhat.com

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

docker_container

ANSIBLE VERSION
ansible 2.6.0

Fixes: GH 34320

Signed-off-by: Amol Kahat <akahat@redhat.com>
@ansibot
Copy link
Contributor

ansibot commented Mar 28, 2018

@ansibot ansibot added cloud community_review In order to be merged, this PR must follow the community review workflow. docker feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Mar 28, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Mar 29, 2018
@Akasurde Akasurde changed the title Added nano_cups parameter in the docker_container.py file. Added nano_cpus parameter in the docker_container.py file. Mar 29, 2018
@benbro
Copy link

benbro commented Mar 29, 2018

nano_cpus:

Why is it called "nano_cpus"? What does nano means?
moby/moby#24713 (comment)

    description:
        - Specify how much CPU resources a container can use.
    default: 0

What are the units? Is it between 0-1 or 0-100% or 0-num-cpus?

--cpus=value option is much simpler:

Specify how much of the available CPU resources a container can use.
For instance, if the host machine has two CPUs and you set --cpus="1.5",
the container is guaranteed at most one and a half of the CPUs.
This is the equivalent of setting --cpu-period="100000" and --cpu-quota="150000".
Available in Docker 1.13 and higher.

@amolkahat
Copy link
Contributor Author

@benbro In the docker-py library it is mentioned as nano_cpus. As of this reference, I took it as a nano_cpus.

If you want I'll update it to cpus.

@benbro
Copy link

benbro commented Apr 2, 2018

@amolkahat there are several ways to limit CPU with the docker API. This blog says:

Specifying cpu usage in nanoseconds for a user is sometimes hard to determine when you want to do simple tasks such as limiting a container to one core.

So it's not just changing the name but the way it works.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 10, 2018
@ansibot ansibot added the affects_2.6 This issue/PR affects Ansible v2.6 label May 20, 2018
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels May 28, 2018
@ansibot
Copy link
Contributor

ansibot commented Aug 24, 2018

@felixfontein
Copy link
Contributor

I think we should offer something like --cpu.

About implementing this: I noticed that nano_cpu is missing in the update() function. So maybe we should use cpu_period and cpu_quota, as described in the --cpu documentation.

@@ -48,6 +48,11 @@
- Command to execute when the container starts.
A command may be either a string or a list.
Prior to version 2.4, strings were split on commas.
nano_cpus:
description:
- Specify how much CPU resources a container can use.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the name says "nano", it would be interesting to tell the unit. In this case is 1e-9.

@ansibot
Copy link
Contributor

ansibot commented Nov 1, 2018

@gundalow
Copy link
Contributor

gundalow commented Dec 4, 2018

Hi,
This PR seems to have gotten stuck, so we are going to close it. We like to include community contributions, so this is a difficult call for us. Here's why we're closing this one:

  • Given the discussion in Docker Agenda/Task list community#408 (comment)
  • Redesign needed
  • It was created from an old version of the code
  • We want to clear out the backlog so it's easier to find bug fixes
  • There haven't been any comments or other activity in a long time

If you're the PR author, and you want to start the conversation back up, please:

  • reopen the PR and
  • rebase the branch

If you're a community member, and you want to see this change merged, please:

  • Create a new PR and
  • Reference this author in the git commit & PR and
  • Reference this PR in the new PR

If you've like to help with the Docker modules please comment on the Docker Agenda/Task List

How to rebase a branch: https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html
How to communicate with the Ansible community: https://docs.ansible.com/ansible/devel/community/communication.html
How to contribute to Ansible: https://docs.ansible.com/ansible/devel/community/index.html

needs_info

@gundalow gundalow closed this Dec 4, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 cloud docker feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker_container - missing --cpus=<value>
7 participants