Skip to content

Commit

Permalink
Remove deprecated atexit_shutdown_grace_period (#435)
Browse files Browse the repository at this point in the history
* remove deprecated configuration function

* add newsfragment and fix docs
  • Loading branch information
richardsheridan authored Oct 20, 2024
1 parent 4fea5fa commit 9f49d53
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 36 deletions.
4 changes: 2 additions & 2 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ trio-parallel 1.2.0 (2022-10-29)
Features
~~~~~~~~

- The behavior of the default context is now fully configurable, superseding `atexit_shutdown_grace_period` (`#328 <https://github.com/richardsheridan/trio-parallel/issues/328>`__)
- The behavior of the default context is now fully configurable, superseding ``atexit_shutdown_grace_period`` (`#328 <https://github.com/richardsheridan/trio-parallel/issues/328>`__)


Bugfixes
Expand Down Expand Up @@ -131,7 +131,7 @@ Features

- Added configuration options for the grace periods permitted to worker caches upon
shutdown. This includes a new keyword argument for :func:`open_worker_context` and
a new top level function :func:`atexit_shutdown_grace_period`. (`#108 <https://github.com/richardsheridan/trio-parallel/issues/108>`__)
a new top level function ``atexit_shutdown_grace_period``. (`#108 <https://github.com/richardsheridan/trio-parallel/issues/108>`__)
- :func:`open_worker_context` gained a new argument, ``init``, and ``retire`` is no longer
called before the first job in the worker. (`#110 <https://github.com/richardsheridan/trio-parallel/issues/110>`__)

Expand Down
2 changes: 0 additions & 2 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ Internal Esoterica

You probably won't use these... but create an issue if you do and need help!

.. autofunction:: atexit_shutdown_grace_period

.. autofunction:: default_context_statistics

.. _cloudpickle: https://github.com/cloudpipe/cloudpickle
Expand Down
1 change: 1 addition & 0 deletions newsfragments/435.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed deprecated ``atexit_shutdown_grace_period``. Use `configure_default_context` to configure the default context shutdown grace period.
1 change: 0 additions & 1 deletion trio_parallel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
WorkerType,
current_default_worker_limiter,
configure_default_context,
atexit_shutdown_grace_period,
default_context_statistics,
)
from ._abc import BrokenWorkerError
Expand Down
2 changes: 1 addition & 1 deletion trio_parallel/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BrokenWorkerError(RuntimeError):
failure of either ``trio-parallel`` or the code that was executing in the worker.
Some example failures may include segfaults, being killed by an external signal,
or failing to cleanly shut down within a specified ``grace_period``. (See
:func:`atexit_shutdown_grace_period` and :func:`open_worker_context`.)
:func:`configure_default_context` and :func:`open_worker_context`.)
"""


Expand Down
30 changes: 0 additions & 30 deletions trio_parallel/_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,36 +376,6 @@ async def open_worker_context(
await ctx._aclose() # noqa: ASYNC102


def atexit_shutdown_grace_period(
grace_period=DEFAULT_CONTEXT.grace_period,
): # pragma: no cover, deprecated
"""Set the default worker cache shutdown grace period.
DEPRECATION NOTICE: this function has been superseded by
`configure_default_context` and will be removed in a future version
You might need this if you have a long-running `atexit` function, such as those
installed by ``coverage.py`` or ``viztracer``.
This only affects the `atexit` behavior of the default context corresponding to
:func:`trio_parallel.run_sync`. Existing and future `WorkerContext` instances
are unaffected.
Args:
grace_period (float): The time in seconds to wait for workers to
exit before issuing SIGKILL/TerminateProcess and raising `BrokenWorkerError`.
Pass `math.inf` to wait forever.
"""
import warnings

warnings.warn(
DeprecationWarning(
"Superseded by `configure_default_context` "
"and will be removed in a future version"
)
)
configure_default_context(grace_period=grace_period)


async def run_sync(
sync_fn: Callable[..., T],
*args,
Expand Down

0 comments on commit 9f49d53

Please sign in to comment.