Skip to content

Commit ecb133b

Browse files
committed
Rename to QUEUE_SELECTOR
1 parent 4ef2279 commit ecb133b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

cvat/apps/redis_handler/apps.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __getitem__(self, key: str | tuple) -> str:
2121
return super().__getitem__(key)
2222

2323

24-
ACTION_TO_QUEUE = LayeredKeyDict()
24+
QUEUE_SELECTOR = LayeredKeyDict()
2525
QUEUE_TO_PARSED_JOB_ID_CLS = {}
2626

2727
REQUEST_ID_SUBCLASSES = set()
@@ -47,7 +47,7 @@ def init_subclasses(cur_cls: type[RequestId] = RequestId):
4747
for queue_selector in parsed_job_id_cls.QUEUE_SELECTORS:
4848
if not isinstance(queue_selector, (tuple, str)):
4949
raise ImproperlyConfigured("Wrong queue selector, must be either tuple or str")
50-
ACTION_TO_QUEUE[queue_selector] = queue_name
50+
QUEUE_SELECTOR[queue_selector] = queue_name
5151

5252
QUEUE_TO_PARSED_JOB_ID_CLS[queue_name] = parsed_job_id_cls
5353

@@ -62,7 +62,7 @@ def init_subclasses(cur_cls: type[RequestId] = RequestId):
6262

6363
if subclass.QUEUE_SELECTORS:
6464
for queue_selector in subclass.QUEUE_SELECTORS:
65-
if not ACTION_TO_QUEUE.get(queue_selector):
65+
if not QUEUE_SELECTOR.get(queue_selector):
6666
raise ImproperlyConfigured(
6767
f"Queue selector {queue_selector!r} for the class {subclass.__name__!r} is missed in the queue configuration"
6868
)

cvat/apps/redis_handler/rq.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from rq.job import Job as RQJob
1212

1313
from cvat.apps.redis_handler.apps import (
14-
ACTION_TO_QUEUE,
14+
QUEUE_SELECTOR,
1515
QUEUE_TO_PARSED_JOB_ID_CLS,
1616
REQUEST_ID_SUBCLASSES,
1717
)
@@ -161,7 +161,7 @@ def parse(
161161
f"Unable to parse request ID: {escape(request_id)!r}"
162162
)
163163

164-
queue = ACTION_TO_QUEUE[
164+
queue = QUEUE_SELECTOR[
165165
actual_cls.QUEUE_SELECTORS[0]
166166
] # each selector match the same queue
167167
fragments = match.groupdict()
@@ -178,7 +178,7 @@ def parse(
178178

179179
if not queue:
180180
# try to define queue dynamically based on action/target/subresource
181-
queue = ACTION_TO_QUEUE[
181+
queue = QUEUE_SELECTOR[
182182
(dict_repr["action"], dict_repr["target"], dict_repr.get("subresource"))
183183
]
184184

cvat/apps/redis_handler/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from cvat.apps.engine.log import ServerLogManager
2626
from cvat.apps.engine.rq import is_rq_job_owner
2727
from cvat.apps.engine.types import ExtendedRequest
28-
from cvat.apps.redis_handler.apps import ACTION_TO_QUEUE
28+
from cvat.apps.redis_handler.apps import QUEUE_SELECTOR
2929
from cvat.apps.redis_handler.rq import CustomRQJob, RequestId
3030
from cvat.apps.redis_handler.serializers import RequestSerializer, RequestStatus
3131

@@ -107,7 +107,7 @@ def get_queryset(self):
107107

108108
@property
109109
def queues(self) -> Iterable[DjangoRQ]:
110-
return (django_rq.get_queue(queue_name) for queue_name in set(ACTION_TO_QUEUE.values()))
110+
return (django_rq.get_queue(queue_name) for queue_name in set(QUEUE_SELECTOR.values()))
111111

112112
def _get_rq_jobs_from_queue(self, queue: DjangoRQ, user_id: int) -> list[RQJob]:
113113
job_ids = set(

0 commit comments

Comments
 (0)