Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Oct 26, 2016
1 parent 071675f commit fccc4de
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
14 changes: 14 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,22 @@ Task Class
:members:


Result Class
------------

.. autoclass:: kuyruk.result.Result
:members:


Config Class
------------

.. autoclass:: kuyruk.Config
:members:


Exceptions
----------

.. automodule:: kuyruk.exceptions
:members:
10 changes: 10 additions & 0 deletions kuyruk/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def _process_message(self, message):
self.exception = d.get('exception')

def wait(self, timeout):
"""
Wait for task result for ``timeout`` seconds.
If timeout occurs, :class:`~kuyruk.exceptions.ResultTimeout` is raised.
If excecption occurs in worker,
:class:`~kuyruk.exceptions.RemoteException` is raised.
:param timeout: Seconds to wait for the result.
:return: The result from remote task execution.
"""
logger.debug("Waiting for task result")

start = time.time()
Expand Down
5 changes: 3 additions & 2 deletions kuyruk/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def send_to_queue(self, args=(), kwargs={}, host=None, local=False):
def run_in_queue(self, args=(), kwargs={}, host=None, local=False):
"""
Returns a context manager to send a message to the queue and
getting result back.
getting result back. Context manager yields a
:class:`~kuyruk.result.Result` object for waiting for result.
:param args: Arguments that will be passed to task on execution.
:param kwargs: Keyword arguments that will be passed to task
Expand All @@ -94,7 +95,7 @@ def run_in_queue(self, args=(), kwargs={}, host=None, local=False):
appended to the queue name.
:param local: Send this task to this host. Hostname of current host
will be appended to the queue name.
:return: :const:`None`
:return: A context manager.
"""
if self.kuyruk.config.EAGER:
Expand Down

0 comments on commit fccc4de

Please sign in to comment.