A grab bag of shortcomings, ideas, and a place to disucss them
Finding python to find python
Ansible's native interpreter discovery makes one call to sh, with a list of candidate interepreters from INTERPRETER_PYTHON_FALLBACK. Mitogen turns this into several attempts to call a list of (Mitogen) candidate interpreters. So an O(1) operation becomes O(N).
- Can the list be shortened and/or the order optimised?
- Can the O(N) be eliminated?
- Make an exception to Mitogen's design, call
sh with Ansible's snippet instead
- Devise a shell construction that calls one of the Python interpreters
- Should the Mitogen list be derived from/enhanced with Ansible's INTERPRETER_PYTHON_FALLBACK list?
|
# TODO: HACK: if finding python interpreter then we need to keep |
|
# calling exec_command until we run into the right python we'll use |
|
# chicken-and-egg issue, mitogen needs a python to run low_level_execute_command |
|
# which is required by Ansible's discover_interpreter function |
|
if self._finding_python_interpreter: |
|
possible_pythons = [ |
|
'/usr/bin/python', |
|
'python3', |
|
'python3.7', |
|
'python3.6', |
|
'python3.5', |
|
'python2.7', |
|
'python2.6', |
|
'/usr/libexec/platform-python', |
|
'/usr/bin/python3', |
|
'python' |
/usr/bin/python fallback
Depending on the setting INTERPRETER_PYTHON Ansible may fallback to /usr/bin/python or (I think) throw an error. I'm not convinced Mitogen always respects that setting.
|
s = run_interpreter_discovery_if_necessary(s, task_vars, action, rediscover_python) |
|
# if unable to determine python_path, fallback to '/usr/bin/python' |
|
if not s: |
|
s = '/usr/bin/python' |
related
A grab bag of shortcomings, ideas, and a place to disucss them
Finding python to find python
Ansible's native interpreter discovery makes one call to
sh, with a list of candidate interepreters from INTERPRETER_PYTHON_FALLBACK. Mitogen turns this into several attempts to call a list of (Mitogen) candidate interpreters. So an O(1) operation becomes O(N).shwith Ansible's snippet insteadmitogen/ansible_mitogen/mixins.py
Lines 461 to 476 in 0953a93
/usr/bin/python fallback
Depending on the setting INTERPRETER_PYTHON Ansible may fallback to
/usr/bin/pythonor (I think) throw an error. I'm not convinced Mitogen always respects that setting.mitogen/ansible_mitogen/transport_config.py
Lines 146 to 149 in 0953a93
related