Skip to content

Commit

Permalink
nitpick docs
Browse files Browse the repository at this point in the history
  • Loading branch information
richardsheridan committed Oct 5, 2021
1 parent e5a4b5b commit ae6c996
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Configuring workers
-------------------

.. autofunction:: open_worker_context
:async-with: ctx

.. autoclass:: WorkerContext
:members:
Expand Down
6 changes: 3 additions & 3 deletions trio_parallel/_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ async def open_worker_context(
that is shared across sequential and between concurrent :func:`trio.run()`
calls, with workers' lifetimes limited to the life of the main process. This
covers most use cases, but for the many edge cases, this async context manager
yields a `WorkerContext` object on which `WorkerContext.run_sync()` pulls workers
yields a `WorkerContext` object on which `~WorkerContext.run_sync()` pulls workers
from an isolated cache with behavior specified by the class arguments. It is only
advised to use this if specific control over worker type, state, or
lifetime is required.
The context will automatically wait for any running workers to become idle when
exiting the scope. Since this wait cannot be canceled, it is more convenient to
exiting the scope. Since this wait cannot be cancelled, it is more convenient to
only pass the context object to tasks that cannot outlive the scope, for example,
by using a nursery.
by using a :class:`~trio.Nursery`.
Args:
idle_timeout (float): The time in seconds an idle worker will
Expand Down
8 changes: 2 additions & 6 deletions trio_parallel/_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ def asyncify_pipes(receive_fd, send_fd):


class BrokenWorkerProcessError(_abc.BrokenWorkerError):
"""Raised when a worker process fails or dies unexpectedly.
This error is not typically encountered in normal use, and indicates a severe
failure of either trio-parallel or the code that was executing in the worker.
__doc__ = f"""{_abc.BrokenWorkerError.__doc__}
The last argument of the exception is the underlying
:class:`multiprocessing.Process` which may be inspected for e.g. exit codes.
"""
Expand Down Expand Up @@ -90,7 +86,7 @@ def shutdown(self, timeout):
if unclean or killed:
for proc in killed:
proc.join()
raise _abc.BrokenWorkerError(
raise BrokenWorkerProcessError(
f"Graceful shutdown failed: {len(unclean)} nonzero exit codes "
f"and {len(killed)} forceful terminations.",
*unclean,
Expand Down

0 comments on commit ae6c996

Please sign in to comment.