is_suspended (rq/suspension.py)

rq · rq/suspension.py · python · BSD-2-Clause
database

Utility to suspend, resume, and check RQ worker suspension status.

# Source: https://github.com/rq/rq | License: BSD-2-Clause | Copyright 2012 Vincent Driessen. All rights reserved
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from redis import Redis

    from rq.worker import BaseWorker

from .defaults import RQ_KEY_PREFIX

WORKERS_SUSPENDED = RQ_KEY_PREFIX + ':suspended'


def is_suspended(connection: Redis, worker: BaseWorker | None = None):
    """Checks whether a Worker is suspended on a given connection
    PS: pipeline returns a list of responses
    Ref: https://github.com/andymccurdy/redis-py#pipelines

    Args:
        connection (Redis): The Redis Connection
        worker (Optional[Worker], optional): The Worker. Defaults to None.
   

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key