|
|
|
@ -3,11 +3,11 @@ import sys
|
|
|
|
|
import traceback
|
|
|
|
|
import uuid
|
|
|
|
|
import warnings
|
|
|
|
|
|
|
|
|
|
from collections import namedtuple
|
|
|
|
|
from datetime import datetime, timezone, timedelta
|
|
|
|
|
from functools import total_ordering
|
|
|
|
|
from typing import TYPE_CHECKING, Dict, List, Any, Callable, Optional, Tuple, Type, Union
|
|
|
|
|
|
|
|
|
|
from redis import WatchError
|
|
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
@ -24,7 +24,6 @@ from .types import FunctionReferenceType, JobDependencyType
|
|
|
|
|
from .serializers import resolve_serializer
|
|
|
|
|
from .utils import backend_class, get_version, import_attribute, make_colorizer, parse_timeout, utcnow, compact
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
green = make_colorizer('darkgreen')
|
|
|
|
|
yellow = make_colorizer('darkyellow')
|
|
|
|
|
blue = make_colorizer('darkblue')
|
|
|
|
@ -196,6 +195,12 @@ class Queue:
|
|
|
|
|
"""Redis key used to indicate this queue has been cleaned."""
|
|
|
|
|
return 'rq:clean_registries:%s' % self.name
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def scheduler_pid(self) -> int:
|
|
|
|
|
from rq.scheduler import RQScheduler
|
|
|
|
|
pid = self.connection.get(RQScheduler.get_locking_key(self.name))
|
|
|
|
|
return int(pid.decode()) if pid is not None else None
|
|
|
|
|
|
|
|
|
|
def acquire_cleaning_lock(self) -> bool:
|
|
|
|
|
"""Returns a boolean indicating whether a lock to clean this queue
|
|
|
|
|
is acquired. A lock expires in 899 seconds (15 minutes - 1 second)
|
|
|
|
|