pyworkflow.utils.retry_streaming moduleο
- pyworkflow.utils.retry_streaming.is_sqlite_lock_error(exc: Exception) bool[source]ο
Return True if exc is a SQLite OperationalError indicating locked/busy DB.
- pyworkflow.utils.retry_streaming.retry_on_sqlite_lock(max_attempts: int = 15, initial_delay: float = 0.25, backoff_factor: float = 1.7, max_delay: float = 10, jitter: float = 0.05, log=None, predicate=<function is_sqlite_lock_error>)[source]ο
Decorator that retries the wrapped function when SQLite signals lock/busy.
- Behavior:
Exponential backoff with small jitter to avoid retry synchronization.
Only retries when predicate(exc) is True (i.e., lock/busy by default).
Propagates any non-retriable exceptions immediately.
If max attempts are exhausted, re-raises the original exception.
- Parameters:
max_attempts Max number of tries (including the first call). initial_delay Initial sleep before the first retry (seconds). backoff_factor Multiply delay on each retry. max_delay Cap the delay (seconds). jitter Random noise added to delay (seconds). log Optional logger (e.g., logging.getLogger(__name__)). predicate Function deciding whether the exception should be retried.