Timeouts¶
Utilities for performing local, signal-based timeouts. Implementation from https://github.com/glenfant/stopit under the MIT license.
from prairielearn.timeout_utils import ...
SignalTimeout ¶
Context manager for limiting the execution time of a block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds
|
float | int
|
duration to run the context manager block |
required |
swallow_exc
|
bool
|
|
True
|
__exit__ ¶
__exit__(
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> bool
Manages exceptions & timeout.
ThreadingTimeout ¶
Deprecated alias for SignalTimeout.
TimeoutExceptionError ¶
Raised when the block under context management takes longer to complete than the allowed maximum timeout value.