mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Tweak how strategies evaluate failed hosts via the iterator and bug fixes
* Added additional methods to the iterator code to assess host failures while also taking into account the block rescue/always states * Fixed bugs in the free strategy, where results were not always being processed after being collected * Added some prettier printing to the state output from iterator Fixes #13699
This commit is contained in:
parent
6f2f7a79b3
commit
210cf06d9a
3 changed files with 49 additions and 14 deletions
|
@ -78,7 +78,7 @@ class StrategyModule(StrategyBase):
|
|||
(state, task) = iterator.get_next_task_for_host(host, peek=True)
|
||||
display.debug("free host state: %s" % state)
|
||||
display.debug("free host task: %s" % task)
|
||||
if host_name not in self._tqm._failed_hosts and host_name not in self._tqm._unreachable_hosts and task:
|
||||
if not iterator.is_failed(host) and host_name not in self._tqm._unreachable_hosts and task:
|
||||
|
||||
# set the flag so the outer loop knows we've still found
|
||||
# some work which needs to be done
|
||||
|
@ -135,7 +135,7 @@ class StrategyModule(StrategyBase):
|
|||
if last_host == starting_host:
|
||||
break
|
||||
|
||||
results = self._process_pending_results(iterator)
|
||||
results = self._wait_on_pending_results(iterator)
|
||||
host_results.extend(results)
|
||||
|
||||
try:
|
||||
|
@ -176,13 +176,7 @@ class StrategyModule(StrategyBase):
|
|||
display.debug("done adding collected blocks to iterator")
|
||||
|
||||
# pause briefly so we don't spin lock
|
||||
time.sleep(0.05)
|
||||
|
||||
try:
|
||||
results = self._wait_on_pending_results(iterator)
|
||||
host_results.extend(results)
|
||||
except Exception as e:
|
||||
pass
|
||||
time.sleep(0.001)
|
||||
|
||||
# run the base class run() method, which executes the cleanup function
|
||||
# and runs any outstanding handlers which have been triggered
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue