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

T woerner max concurrent #60702

Merged
merged 4 commits into from Aug 28, 2019

Conversation

@jimi-c
Copy link
Member

commented Aug 16, 2019

Resubmission of this branch with a few additional changes/fixes.

@sivel sivel requested review from sivel and nitzmahone Aug 16, 2019

lib/ansible/plugins/strategy/__init__.py Outdated Show resolved Hide resolved
lib/ansible/plugins/strategy/__init__.py Outdated Show resolved Hide resolved
lib/ansible/plugins/strategy/free.py Outdated Show resolved Hide resolved

@jimi-c jimi-c force-pushed the jimi-c:t-woerner-max_concurrent branch 3 times, most recently to 0285eb6 Aug 19, 2019

@jimi-c jimi-c force-pushed the jimi-c:t-woerner-max_concurrent branch from 0285eb6 to aae31dd Aug 27, 2019

t-woerner added 3 commits Jul 9, 2018
play, block, task: New attribute forks
With this it is possible to limit the number of concurrent task runs.
forks can now be used in play, block and task. If forks is set in different
levels in the chain, then the smallest value will be used for the task.

The attribute has been added to the Base class as a list to easily provide
all the values that have been set in the different levels of the chain.

A warning has been added because of the conflict with run_once. forks will
be ignored in this case.

The forks limitation in StrategyBase._queue_task is not used for the free
strategy.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Handle forks in free strategy
The forks attribute for the free strategy is handled in run in the free
StrategyModule. This is dony by counting the amount of tasks where the uuid
is the same as the current task, that should be queued next. If this amount
is bigger or equal to the forks attribute from the chain (task, block,
play), then it will be skipped to the next host. Like it is also done with
blocked_hosts.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Test cases for forks with linear and free strategy
With ansible_python_interpreter defined in inventory file using
ansible_playbook_python.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

@jimi-c jimi-c force-pushed the jimi-c:t-woerner-max_concurrent branch 2 times, most recently from e3fe6a8 to fe3c439 Aug 27, 2019

@bcoca
bcoca approved these changes Aug 28, 2019

@jimi-c jimi-c force-pushed the jimi-c:t-woerner-max_concurrent branch 2 times, most recently from aee3844 to 01cd17b Aug 28, 2019

@jimi-c jimi-c force-pushed the jimi-c:t-woerner-max_concurrent branch from 01cd17b to dda1b30 Aug 28, 2019

@jimi-c jimi-c merged commit 51b33b7 into ansible:devel Aug 28, 2019

1 check failed

Shippable Run 140735 status is UNSTABLE.
Details
@@ -68,6 +68,7 @@ serial: |
strategy: Allows you to choose the connection plugin to use for the play.
tags: Tags applied to the task or included tasks, this allows selecting subsets of tasks from the command line.
tasks: Main list of tasks to execute in the play, they run after :term:`roles` and before :term:`post_tasks`.
throttle: Limit number of concurrent task runs on task, block and playbook level. This is independent of the forks and serial settings, but cannot be set higher than those limits. For example, if forks is set to 10 and the throttle is set to 15, at most 10 hosts will be operated on in parallel.

This comment has been minimized.

Copy link
@kustodian

kustodian Aug 29, 2019

Contributor

@jimi-c I guess playbook is a typo, it should be play?

adharshsrivatsr added a commit to adharshsrivatsr/ansible that referenced this pull request Sep 3, 2019
T woerner max concurrent (ansible#60702)
* play, block, task: New attribute forks

With this it is possible to limit the number of concurrent task runs.
forks can now be used in play, block and task. If forks is set in different
levels in the chain, then the smallest value will be used for the task.

The attribute has been added to the Base class as a list to easily provide
all the values that have been set in the different levels of the chain.

A warning has been added because of the conflict with run_once. forks will
be ignored in this case.

The forks limitation in StrategyBase._queue_task is not used for the free
strategy.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

* Handle forks in free strategy

The forks attribute for the free strategy is handled in run in the free
StrategyModule. This is dony by counting the amount of tasks where the uuid
is the same as the current task, that should be queued next. If this amount
is bigger or equal to the forks attribute from the chain (task, block,
play), then it will be skipped to the next host. Like it is also done with
blocked_hosts.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

* Test cases for forks with linear and free strategy

With ansible_python_interpreter defined in inventory file using
ansible_playbook_python.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

* Changing forks keyword to throttle and adding some more docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.