From d6d2251929c84c3aa883bad7db0f19cc9ff0339e Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Thu, 3 Oct 2024 16:02:02 +0200 Subject: Reduce number of implicit meta tasks (#84007) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This greatly reduces run time on large inventories since meta tasks are executed in the main process sequentially and just executing them is expensive. This change avoids running the following implicit meta tasks: * ``flush_handlers`` on hosts where no handlers are notified * ``noop`` for the linear strategy's lockstep, instead hosts that are not executing the current task are just not part of the current host loop A playbook consiting of two simple plays both running on ~6000 hosts runs in: devel: 37s this PR: 1.3s Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) --- .../handlers/handler_notify_earlier_handler.yml | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/integration/targets/handlers/handler_notify_earlier_handler.yml (limited to 'test/integration/targets/handlers/handler_notify_earlier_handler.yml') diff --git a/test/integration/targets/handlers/handler_notify_earlier_handler.yml b/test/integration/targets/handlers/handler_notify_earlier_handler.yml new file mode 100644 index 0000000000..cb16277619 --- /dev/null +++ b/test/integration/targets/handlers/handler_notify_earlier_handler.yml @@ -0,0 +1,33 @@ +- hosts: localhost + gather_facts: false + tasks: + - name: test implicit flush_handlers tasks pick up notifications done by handlers themselves + command: echo + notify: h2 + handlers: + - name: h1 + debug: + msg: h1_ran + + - name: h2 + debug: + msg: h2_ran + changed_when: true + notify: h1 + +- hosts: localhost + gather_facts: false + tasks: + - name: test implicit flush_handlers tasks pick up notifications done by handlers themselves + command: echo + notify: h3 + handlers: + - name: h3 + debug: + msg: h3_ran + changed_when: true + notify: h4 + + - name: h4 + debug: + msg: h4_ran -- cgit v1.2.3