mitogen/docs/api.rst

140 lines
3.0 KiB
ReStructuredText
Raw Normal View History

2016-08-12 17:45:26 +00:00
API Reference
2016-08-13 23:16:17 +00:00
*************
Package Layout
==============
2017-09-11 04:08:28 +00:00
mitogen Package
---------------
2016-08-13 23:16:17 +00:00
2017-09-11 04:08:28 +00:00
.. automodule:: mitogen
2016-08-13 23:16:17 +00:00
.. autodata:: mitogen.is_master
2017-09-11 04:08:28 +00:00
.. autodata:: mitogen.context_id
.. autodata:: mitogen.parent_id
2017-09-07 11:08:05 +00:00
2016-08-12 17:45:26 +00:00
2017-09-11 04:08:28 +00:00
mitogen.core
------------
2016-08-12 17:45:26 +00:00
2017-09-18 09:20:41 +00:00
.. module:: mitogen.core
This module implements most package functionality, but remains separate from
non-essential code in order to reduce its size, since it is also serves as the
bootstrap implementation sent to every new slave context.
2016-08-13 23:16:17 +00:00
.. function:: mitogen.core.takes_econtext
Decorator that marks a function or class method to automatically receive a
kwarg named `econtext`, referencing the
:py:class:`econtext.core.ExternalContext` active in the context in which
the function is being invoked in. The decorator is only meaningful when the
function is invoked via :py:data:`econtext.core.CALL_FUNCTION`.
When the function is invoked directly, `econtext` must still be passed to it
explicitly.
.. function:: mitogen.core.takes_router
Decorator that marks a function or class method to automatically receive a
kwarg named `router`, referencing the :py:class:`econtext.core.Router`
active in the context in which the function is being invoked in. The
decorator is only meaningful when the function is invoked via
:py:data:`econtext.core.CALL_FUNCTION`.
When the function is invoked directly, `router` must still be passed to it
explicitly.
2016-08-13 23:16:17 +00:00
2017-09-11 04:08:28 +00:00
mitogen.master
--------------
2016-08-13 23:16:17 +00:00
.. module:: mitogen.master
This module implements functionality required by master processes, such as
starting new contexts via SSH. Its size is also restricted, since it must
be sent to any context that will be used to establish additional child
contexts.
2016-08-13 23:16:17 +00:00
2017-09-11 04:08:28 +00:00
mitogen.fakessh
2017-09-07 11:08:05 +00:00
---------------
2017-09-11 04:08:28 +00:00
.. automodule:: mitogen.fakessh
2017-09-11 04:08:28 +00:00
.. autofunction:: mitogen.fakessh.run
2017-09-07 11:08:05 +00:00
Router Class
============
2017-09-11 04:08:28 +00:00
.. autoclass:: mitogen.master.Router
2017-09-07 11:08:05 +00:00
:members:
:inherited-members:
Broker Class
============
2017-09-11 04:08:28 +00:00
.. autoclass:: mitogen.master.Broker
:members:
:inherited-members:
2016-08-13 23:16:17 +00:00
Context Class
=============
2016-08-13 23:16:17 +00:00
2017-09-11 04:08:28 +00:00
.. autoclass:: mitogen.master.Context
2016-08-13 23:16:17 +00:00
:members:
:inherited-members:
2016-08-13 23:16:17 +00:00
Channel Class
-------------
2017-09-11 04:08:28 +00:00
.. autoclass:: mitogen.core.Channel
2016-08-12 17:45:26 +00:00
:members:
Context Class
-------------
2016-08-13 23:16:17 +00:00
2017-09-11 04:08:28 +00:00
.. autoclass:: mitogen.master.Context
2016-08-13 23:16:17 +00:00
:members:
Utility Functions
=================
2016-08-13 23:16:17 +00:00
2017-09-11 04:08:28 +00:00
.. automodule:: mitogen.utils
2016-08-13 23:16:17 +00:00
:members:
Exceptions
==========
2017-09-18 09:20:41 +00:00
.. class:: mitogen.core.Error (fmt, \*args)
Base for all exceptions raised by Mitogen.
.. class:: mitogen.core.CallError (e)
Raised when :py:meth:`Context.call() <mitogen.master.Context.call>` fails.
A copy of the traceback from the external context is appended to the
exception message.
.. class:: mitogen.core.ChannelError (fmt, \*args)
Raised when a channel dies or has been closed.
.. class:: mitogen.core.StreamError (fmt, \*args)
Raised when a stream cannot be established.
.. autoclass:: mitogen.core.TimeoutError (fmt, \*args)
Raised when a timeout occurs on a stream.