Skip to content

Commit

Permalink
Document honcho.manager.Manager
Browse files Browse the repository at this point in the history
Fixes GH-169
  • Loading branch information
mattrobenolt committed Apr 11, 2016
1 parent fd951c6 commit fd5cde1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -68,7 +68,7 @@ The 30-second version:
For more detail and an explanation of the circumstances in which Honcho might
be useful, consult the `Honcho documentation`_.

.. _Honcho documentation: //honcho.readthedocs.org/
.. _Honcho documentation: https://honcho.readthedocs.org/

License
-------
Expand Down
5 changes: 5 additions & 0 deletions doc/api.rst
Expand Up @@ -11,6 +11,11 @@ API Documentation
:undoc-members:
:show-inheritance:

.. automodule:: honcho.manager
:members:
:undoc-members:
:show-inheritance:

.. automodule:: honcho.export.base
:members:
:undoc-members:
Expand Down
15 changes: 12 additions & 3 deletions honcho/manager.py
Expand Up @@ -30,14 +30,23 @@ class Manager(object):
managing the events that result (starting, stopping, printing). By default
it relays printed lines to a printer that prints to STDOUT.
Example:
Example::
import sys
from honcho.manager import Manager
m = Manager()
m.add_process('server', 'ruby server.rb')
m.add_process('worker', 'python worker.py')
m.loop()
sys.exit(m.returncode)
"""

#: After :func:`~honcho.manager.Manager.loop` finishes,
#: this will contain a return code that can be used with `sys.exit`.
returncode = None

def __init__(self, printer=None):
self.events = multiprocessing.Queue()
self.returncode = None
Expand All @@ -56,7 +65,7 @@ def __init__(self, printer=None):
def add_process(self, name, cmd, quiet=False, env=None, cwd=None):
"""
Add a process to this manager instance. The process will not be started
until #loop() is called.
until :func:`~honcho.manager.Manager.loop` is called.
"""
assert name not in self._processes, "process names must be unique"
proc = self._process_ctor(cmd,
Expand All @@ -79,7 +88,7 @@ def loop(self):
printer (which by default will print to STDOUT).
If one process terminates, all the others will be terminated by
Honcho, and #loop() will return.
Honcho, and :func:`~honcho.manager.Manager.loop` will return.
This method will block until all the processes have terminated.
"""
Expand Down

0 comments on commit fd5cde1

Please sign in to comment.