|
|
@ -238,16 +238,16 @@ Router Class
|
|
|
|
.. method:: add_handler (fn, handle=None, persist=True, respondent=None, policy=None)
|
|
|
|
.. method:: add_handler (fn, handle=None, persist=True, respondent=None, policy=None)
|
|
|
|
|
|
|
|
|
|
|
|
Invoke `fn(msg)` for each Message sent to `handle` from this context.
|
|
|
|
Invoke `fn(msg)` for each Message sent to `handle` from this context.
|
|
|
|
Unregister after one invocation if `persist` is ``False``. If `handle`
|
|
|
|
Unregister after one invocation if `persist` is :data:`False`. If
|
|
|
|
is ``None``, a new handle is allocated and returned.
|
|
|
|
`handle` is :data:`None`, a new handle is allocated and returned.
|
|
|
|
|
|
|
|
|
|
|
|
:param int handle:
|
|
|
|
:param int handle:
|
|
|
|
If not ``None``, an explicit handle to register, usually one of the
|
|
|
|
If not :data:`None`, an explicit handle to register, usually one of
|
|
|
|
``mitogen.core.*`` constants. If unspecified, a new unused handle
|
|
|
|
the ``mitogen.core.*`` constants. If unspecified, a new unused
|
|
|
|
will be allocated.
|
|
|
|
handle will be allocated.
|
|
|
|
|
|
|
|
|
|
|
|
:param bool persist:
|
|
|
|
:param bool persist:
|
|
|
|
If ``False``, the handler will be unregistered after a single
|
|
|
|
If :data:`False`, the handler will be unregistered after a single
|
|
|
|
message has been received.
|
|
|
|
message has been received.
|
|
|
|
|
|
|
|
|
|
|
|
:param mitogen.core.Context respondent:
|
|
|
|
:param mitogen.core.Context respondent:
|
|
|
@ -281,7 +281,8 @@ Router Class
|
|
|
|
sender indicating refusal occurred.
|
|
|
|
sender indicating refusal occurred.
|
|
|
|
|
|
|
|
|
|
|
|
:return:
|
|
|
|
:return:
|
|
|
|
`handle`, or if `handle` was ``None``, the newly allocated handle.
|
|
|
|
`handle`, or if `handle` was :data:`None`, the newly allocated
|
|
|
|
|
|
|
|
handle.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: del_handler (handle)
|
|
|
|
.. method:: del_handler (handle)
|
|
|
|
|
|
|
|
|
|
|
@ -300,10 +301,10 @@ Router Class
|
|
|
|
called from the I/O multiplexer thread.
|
|
|
|
called from the I/O multiplexer thread.
|
|
|
|
|
|
|
|
|
|
|
|
:param mitogen.core.Stream stream:
|
|
|
|
:param mitogen.core.Stream stream:
|
|
|
|
If not ``None``, a reference to the stream the message arrived on.
|
|
|
|
If not :data:`None`, a reference to the stream the message arrived
|
|
|
|
Used for performing source route verification, to ensure sensitive
|
|
|
|
on. Used for performing source route verification, to ensure
|
|
|
|
messages such as ``CALL_FUNCTION`` arrive only from trusted
|
|
|
|
sensitive messages such as ``CALL_FUNCTION`` arrive only from
|
|
|
|
contexts.
|
|
|
|
trusted contexts.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: route(msg)
|
|
|
|
.. method:: route(msg)
|
|
|
|
|
|
|
|
|
|
|
@ -515,8 +516,8 @@ Router Class
|
|
|
|
otherwise.
|
|
|
|
otherwise.
|
|
|
|
|
|
|
|
|
|
|
|
:param mitogen.core.Context via:
|
|
|
|
:param mitogen.core.Context via:
|
|
|
|
If not ``None``, arrange for construction to occur via RPCs made to
|
|
|
|
If not :data:`None`, arrange for construction to occur via RPCs
|
|
|
|
the context `via`, and for :py:data:`ADD_ROUTE
|
|
|
|
made to the context `via`, and for :py:data:`ADD_ROUTE
|
|
|
|
<mitogen.core.ADD_ROUTE>` messages to be generated as appropriate.
|
|
|
|
<mitogen.core.ADD_ROUTE>` messages to be generated as appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
.. code-block:: python
|
|
|
@ -567,7 +568,7 @@ Router Class
|
|
|
|
:data:`None`, which Docker interprets as ``root``.
|
|
|
|
:data:`None`, which Docker interprets as ``root``.
|
|
|
|
:param str image:
|
|
|
|
:param str image:
|
|
|
|
Image tag to use to construct a temporary container. Defaults to
|
|
|
|
Image tag to use to construct a temporary container. Defaults to
|
|
|
|
``None``.
|
|
|
|
:data:`None`.
|
|
|
|
:param str docker_path:
|
|
|
|
:param str docker_path:
|
|
|
|
Filename or complete path to the Docker binary. ``PATH`` will be
|
|
|
|
Filename or complete path to the Docker binary. ``PATH`` will be
|
|
|
|
searched if given as a filename. Defaults to ``docker``.
|
|
|
|
searched if given as a filename. Defaults to ``docker``.
|
|
|
@ -596,7 +597,7 @@ Router Class
|
|
|
|
Accepts all parameters accepted by :py:meth:`local`, in addition to:
|
|
|
|
Accepts all parameters accepted by :py:meth:`local`, in addition to:
|
|
|
|
|
|
|
|
|
|
|
|
:param str container:
|
|
|
|
:param str container:
|
|
|
|
Existing container to connect to. Defaults to ``None``.
|
|
|
|
Existing container to connect to. Defaults to :data:`None`.
|
|
|
|
:param str lxc_attach_path:
|
|
|
|
:param str lxc_attach_path:
|
|
|
|
Filename or complete path to the ``lxc-attach`` binary. ``PATH``
|
|
|
|
Filename or complete path to the ``lxc-attach`` binary. ``PATH``
|
|
|
|
will be searched if given as a filename. Defaults to
|
|
|
|
will be searched if given as a filename. Defaults to
|
|
|
@ -610,7 +611,7 @@ Router Class
|
|
|
|
Accepts all parameters accepted by :py:meth:`local`, in addition to:
|
|
|
|
Accepts all parameters accepted by :py:meth:`local`, in addition to:
|
|
|
|
|
|
|
|
|
|
|
|
:param str container:
|
|
|
|
:param str container:
|
|
|
|
Existing container to connect to. Defaults to ``None``.
|
|
|
|
Existing container to connect to. Defaults to :data:`None`.
|
|
|
|
:param str lxc_path:
|
|
|
|
:param str lxc_path:
|
|
|
|
Filename or complete path to the ``lxc`` binary. ``PATH`` will be
|
|
|
|
Filename or complete path to the ``lxc`` binary. ``PATH`` will be
|
|
|
|
searched if given as a filename. Defaults to ``lxc``.
|
|
|
|
searched if given as a filename. Defaults to ``lxc``.
|
|
|
@ -790,7 +791,7 @@ Context Class
|
|
|
|
handle which is placed in the message's `reply_to`.
|
|
|
|
handle which is placed in the message's `reply_to`.
|
|
|
|
|
|
|
|
|
|
|
|
:param bool persist:
|
|
|
|
:param bool persist:
|
|
|
|
If ``False``, the handler will be unregistered after a single
|
|
|
|
If :data:`False`, the handler will be unregistered after a single
|
|
|
|
message has been received.
|
|
|
|
message has been received.
|
|
|
|
|
|
|
|
|
|
|
|
:param mitogen.core.Message msg:
|
|
|
|
:param mitogen.core.Message msg:
|
|
|
@ -809,7 +810,7 @@ Context Class
|
|
|
|
The message.
|
|
|
|
The message.
|
|
|
|
|
|
|
|
|
|
|
|
:param float deadline:
|
|
|
|
:param float deadline:
|
|
|
|
If not ``None``, seconds before timing out waiting for a reply.
|
|
|
|
If not :data:`None`, seconds before timing out waiting for a reply.
|
|
|
|
|
|
|
|
|
|
|
|
:raises mitogen.core.TimeoutError:
|
|
|
|
:raises mitogen.core.TimeoutError:
|
|
|
|
No message was received and `deadline` passed.
|
|
|
|
No message was received and `deadline` passed.
|
|
|
@ -931,8 +932,8 @@ Receiver Class
|
|
|
|
Router to register the handler on.
|
|
|
|
Router to register the handler on.
|
|
|
|
|
|
|
|
|
|
|
|
:param int handle:
|
|
|
|
:param int handle:
|
|
|
|
If not ``None``, an explicit handle to register, otherwise an unused
|
|
|
|
If not :data:`None`, an explicit handle to register, otherwise an
|
|
|
|
handle is chosen.
|
|
|
|
unused handle is chosen.
|
|
|
|
|
|
|
|
|
|
|
|
:param bool persist:
|
|
|
|
:param bool persist:
|
|
|
|
If :data:`True`, do not unregister the receiver's handler after the
|
|
|
|
If :data:`True`, do not unregister the receiver's handler after the
|
|
|
@ -940,13 +941,13 @@ Receiver Class
|
|
|
|
|
|
|
|
|
|
|
|
:param mitogen.core.Context respondent:
|
|
|
|
:param mitogen.core.Context respondent:
|
|
|
|
Reference to the context this receiver is receiving from. If not
|
|
|
|
Reference to the context this receiver is receiving from. If not
|
|
|
|
``None``, arranges for the receiver to receive a dead message if
|
|
|
|
:data:`None`, arranges for the receiver to receive a dead message if
|
|
|
|
messages can no longer be routed to the context, due to disconnection
|
|
|
|
messages can no longer be routed to the context, due to disconnection
|
|
|
|
or exit.
|
|
|
|
or exit.
|
|
|
|
|
|
|
|
|
|
|
|
.. attribute:: notify = None
|
|
|
|
.. attribute:: notify = None
|
|
|
|
|
|
|
|
|
|
|
|
If not ``None``, a reference to a function invoked as
|
|
|
|
If not :data:`None`, a reference to a function invoked as
|
|
|
|
`notify(receiver)` when a new message is delivered to this receiver.
|
|
|
|
`notify(receiver)` when a new message is delivered to this receiver.
|
|
|
|
Used by :py:class:`mitogen.select.Select` to implement waiting on
|
|
|
|
Used by :py:class:`mitogen.select.Select` to implement waiting on
|
|
|
|
multiple receivers.
|
|
|
|
multiple receivers.
|
|
|
@ -1000,7 +1001,7 @@ Receiver Class
|
|
|
|
Sleep waiting for a message to arrive on this receiver.
|
|
|
|
Sleep waiting for a message to arrive on this receiver.
|
|
|
|
|
|
|
|
|
|
|
|
:param float timeout:
|
|
|
|
:param float timeout:
|
|
|
|
If not ``None``, specifies a timeout in seconds.
|
|
|
|
If not :data:`None`, specifies a timeout in seconds.
|
|
|
|
|
|
|
|
|
|
|
|
:raises mitogen.core.ChannelError:
|
|
|
|
:raises mitogen.core.ChannelError:
|
|
|
|
The remote end indicated the channel should be closed, or
|
|
|
|
The remote end indicated the channel should be closed, or
|
|
|
@ -1183,10 +1184,10 @@ Select Class
|
|
|
|
message may be posted at any moment between :py:meth:`empty` and
|
|
|
|
message may be posted at any moment between :py:meth:`empty` and
|
|
|
|
:py:meth:`get`.
|
|
|
|
:py:meth:`get`.
|
|
|
|
|
|
|
|
|
|
|
|
:py:meth:`empty` may return ``False`` even when :py:meth:`get` would
|
|
|
|
:py:meth:`empty` may return :data:`False` even when :py:meth:`get`
|
|
|
|
block if another thread has drained a receiver added to this select.
|
|
|
|
would block if another thread has drained a receiver added to this
|
|
|
|
This can be avoided by only consuming each receiver from a single
|
|
|
|
select. This can be avoided by only consuming each receiver from a
|
|
|
|
thread.
|
|
|
|
single thread.
|
|
|
|
|
|
|
|
|
|
|
|
.. py:method:: __iter__ (self)
|
|
|
|
.. py:method:: __iter__ (self)
|
|
|
|
|
|
|
|
|
|
|
@ -1370,8 +1371,8 @@ A random assortment of utility functions useful on masters and children.
|
|
|
|
variables. See :ref:`logging-env-vars`.
|
|
|
|
variables. See :ref:`logging-env-vars`.
|
|
|
|
|
|
|
|
|
|
|
|
:param str path:
|
|
|
|
:param str path:
|
|
|
|
If not ``None``, a filesystem path to write logs to. Otherwise, logs
|
|
|
|
If not :data:`None`, a filesystem path to write logs to. Otherwise,
|
|
|
|
are written to :py:data:`sys.stderr`.
|
|
|
|
logs are written to :py:data:`sys.stderr`.
|
|
|
|
|
|
|
|
|
|
|
|
:param bool io:
|
|
|
|
:param bool io:
|
|
|
|
If :data:`True`, include extremely verbose IO logs in the output.
|
|
|
|
If :data:`True`, include extremely verbose IO logs in the output.
|
|
|
|