docs: more updates.
- accurate description of Ansible timeouts - rough detach() sketch
This commit is contained in:
parent
7f1060f54a
commit
3058efc80f
|
@ -157,9 +157,16 @@ Noteworthy Differences
|
||||||
* Performance does not scale perfectly linearly with target count. This will
|
* Performance does not scale perfectly linearly with target count. This will
|
||||||
improve over time.
|
improve over time.
|
||||||
|
|
||||||
* Timeouts normally apply to the combined runtime of the SSH and become steps
|
* SSH and ``become`` are treated distinctly when applying timeouts, and
|
||||||
of a task. As Mitogen treats SSH and sudo distincly, during a failure the
|
timeouts apply up to the point when the new interpreter is ready to accept
|
||||||
effective timeout may appear to double.
|
messages. Ansible has two timeouts: ``ConnectTimeout`` for SSH, applying up
|
||||||
|
to when authentication completes, and a separate parallel timeout up to when
|
||||||
|
``become`` authentication completes.
|
||||||
|
|
||||||
|
For busy targets, Ansible may successfully execute a module where Mitogen
|
||||||
|
would fail without increasing the timeout. For sick targets, Ansible may hang
|
||||||
|
indefinitely after authentication without executing a command, for example
|
||||||
|
due to a stuck filesystem IO appearing in ``$HOME/.profile``.
|
||||||
|
|
||||||
|
|
||||||
New Features & Notes
|
New Features & Notes
|
||||||
|
|
|
@ -242,10 +242,25 @@ Detached Subtrees
|
||||||
|
|
||||||
.. image:: images/detached-subtree.png
|
.. image:: images/detached-subtree.png
|
||||||
|
|
||||||
It is possible to dynamically construct and decouple individual contexts from
|
Contexts may detach from and outlive the running program, while maintaining
|
||||||
the lifecycle of the running program without terminating them, while enabling
|
communication with descendents in their subtree. This enables persistent
|
||||||
communication with any descendents in the subtree to be maintained. This is
|
background tasks that reuse Mitogen features.
|
||||||
intended to support implementing background tasks.
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
@mitogen.core.takes_econtext
|
||||||
|
def become_monitoring_master(children, econtext):
|
||||||
|
kill_old_process('/var/run/mydaemon.pid')
|
||||||
|
write_pid_file('/var/run/mydaemon.pid')
|
||||||
|
econtext.detach()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
for child in children:
|
||||||
|
if child.call(get_cpu_load) > 0.9:
|
||||||
|
alert_operator('Child is too busy! ' + str(child))
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
dc1.call_async(become_monitoring_master, children)
|
||||||
|
|
||||||
|
|
||||||
Blocking Code Friendly
|
Blocking Code Friendly
|
||||||
|
|
Loading…
Reference in New Issue