Reduce number of iterations through PlayIterator (#74175)

* Reduce number of iterations through PlayIterator

ci_complete

* Use the new set method

ci_complete
pull/76341/head
Martin Krizek 3 years ago committed by GitHub
parent d8aeffc8b7
commit 0ddaf6edd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Reduce number of iterations through PlayIterator (https://github.com/ansible/ansible/pull/74175)

@ -232,8 +232,7 @@ class PlayIterator(metaclass=MetaPlayIterator):
task.get_name() == play_context.start_at_task or fnmatch.fnmatch(task.get_name(), play_context.start_at_task):
start_at_matched = True
break
else:
self.get_next_task_for_host(host)
self.set_state_for_host(host.name, s)
# finally, reset the host's state to IteratingStates.SETUP
if start_at_matched:

@ -156,9 +156,9 @@ class StrategyModule(StrategyBase):
if same_tasks >= throttle:
break
# pop the task, mark the host blocked, and queue it
# advance the host, mark the host blocked, and queue it
self._blocked_hosts[host_name] = True
(state, task) = iterator.get_next_task_for_host(host)
iterator.set_state_for_host(host.name, state)
try:
action = action_loader.get(task.action, class_only=True, collection_list=task.collections)

@ -156,13 +156,13 @@ class StrategyModule(StrategyBase):
host_state_task = host_tasks.get(host.name)
if host_state_task is None:
continue
(s, t) = host_state_task
s = iterator.get_active_state(s)
if t is None:
(state, task) = host_state_task
s = iterator.get_active_state(state)
if task is None:
continue
if s.run_state == cur_state and s.cur_block == cur_block:
new_t = iterator.get_next_task_for_host(host)
rvals.append((host, t))
iterator.set_state_for_host(host.name, state)
rvals.append((host, task))
else:
rvals.append((host, noop_task))
display.debug("done advancing hosts to next task")

Loading…
Cancel
Save