Skip to content

Conversation

AlexeyRokhin
Copy link
Contributor

Hi.
I've recreated request because of my troubles with merging
Added ability to set new cpu parameters (cpu_count, cpu_percent, cpus) for container.

Signed-off-by: Alexey Rokhin arokhin@mail.ru

Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
Copy link
Contributor

@shin- shin- left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to submit a PR!

There's a couple of flake8 failures that need to be fixed:

tests/unit/api_container_test.py:1183:80: E501 line too long (82 > 79 characters)
tests/unit/dockertypes_test.py:175:1: W293 blank line contains whitespace

Once those comments are addressed we should be good to go 👍

cap_add (list of str): Add kernel capabilities. For example,
``["SYS_ADMIN", "MKNOD"]``.
cap_drop (list of str): Drop kernel capabilities.
cpu_count (int): CPU count (Windows only).
Copy link
Contributor

Choose a reason for hiding this comment

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

Please replace with:

Number of usable CPUs (Windows only).

``["SYS_ADMIN", "MKNOD"]``.
cap_drop (list of str): Drop kernel capabilities.
cpu_count (int): CPU count (Windows only).
cpu_percent (int): CPU percent (Windows only).
Copy link
Contributor

Choose a reason for hiding this comment

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

Please replace with:

Usable percentage of the available CPUs (Windows only).

cpu_quota (int): Microseconds of CPU time that the container can
get in a CPU period.
cpu_shares (int): CPU shares (relative weight).
cpus (float): Number of CPUs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's conform with the API here and use

nano_cpus (int): CPU quota in units of 10-9 CPUs.

if version_lt(version, '1.25'):
raise host_config_version_error('cpus', '1.25')

self['NanoCpus'] = int(1000000000 * cpus)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's have nano_cpus be the parameter instead, limit the acceptable types to int and avoid float uncertainty altogether.

…omments for new parameters are changed.

Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
@AlexeyRokhin AlexeyRokhin changed the title Add cpu_count, cpu_percent, cpus parameters to container HostConfig. Add cpu_count, cpu_percent, nano_cpus parameters to container HostConfig. Apr 28, 2017
@AlexeyRokhin
Copy link
Contributor Author

@shin-
Done. Please check.
Should I do anything with your review?

Copy link
Contributor

@shin- shin- left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@shin- shin- added this to the 2.3.0 milestone Apr 28, 2017
@shin- shin- merged commit 72b9b72 into docker:master Apr 28, 2017
@AlexeyRokhin
Copy link
Contributor Author

Preparation for docker/compose#4582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants