From fd5cde11b511f405515ab2994a0b05616f4f2a74 Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Sun, 10 Apr 2016 19:31:04 -0700 Subject: [PATCH] Document honcho.manager.Manager Fixes GH-169 --- README.rst | 2 +- doc/api.rst | 5 +++++ honcho/manager.py | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 913069a..b9b2c64 100644 --- a/README.rst +++ b/README.rst @@ -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 ------- diff --git a/doc/api.rst b/doc/api.rst index 6830ace..70b08ed 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -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: diff --git a/honcho/manager.py b/honcho/manager.py index ff31a8e..116e2fc 100644 --- a/honcho/manager.py +++ b/honcho/manager.py @@ -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 @@ -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, @@ -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. """