ansible_mitogen: Speedup startup by not sending `__main__`
On my laptop his reduces the time to execute `ansible -mping ...` by approx 300 ms with `strategy=mitogen_linear`. Until this commit Mitogen was unnecessarily sending large chunks of Ansible from the controller to targets, due to `__main__` being identified as a related module of `ansible.module_utils.basic`, and resolving to something within `ansible.cli...`. On Ansible target hosts executing any Ansible Module `__main__` is imported by `ansible.module_utils.basic` as part of Ansible's module delivery mechanism. When `mitogen.master.ModuleResponder` (on the controller) processes the request for `ansible.module_utils.basic` from the target, it scans `ansible.module_utils.basic` for related imports and finds `__main__`. However `__main__` on the controller is not the same module as `__main__` on the target. On the controller it is a module in `ansible.cli...` that implements one of the ansible commands (e.g. `ansible`, `ansible-playbook`).pull/1126/head
parent
f191f050bf
commit
83b6cdb616
Loading…
Reference in New Issue