Skip to content

Commit b5d0ffe

Browse files
committed
code refactor
1 parent 94eba11 commit b5d0ffe

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

tasktiger/_internal.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
from .task import Task
2828
from .tasktiger import TaskTiger
2929

30+
# Constants pertaining to Redis keys
31+
TASK = "task"
32+
EXECUTIONS = "executions"
33+
EXECUTIONS_COUNT = "executions_count"
34+
3035
# Task states (represented by different queues)
3136
# Note some client code may rely on the string values (e.g. get_queue_stats).
3237
QUEUED = "queued"

tasktiger/constants.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

tasktiger/migrations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import TYPE_CHECKING
22

3-
from .constants import EXECUTIONS, TASK
3+
from ._internal import EXECUTIONS, TASK
44
from .utils import redis_glob_escape
55

66
if TYPE_CHECKING:

tasktiger/redis_scripts.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33

44
from redis import Redis
55

6-
from ._internal import ACTIVE, ERROR, QUEUED, SCHEDULED
7-
from .constants import EXECUTIONS, EXECUTIONS_COUNT, TASK
6+
from ._internal import (
7+
ACTIVE,
8+
ERROR,
9+
EXECUTIONS,
10+
EXECUTIONS_COUNT,
11+
QUEUED,
12+
SCHEDULED,
13+
TASK,
14+
)
815

916
try:
1017
from redis.commands.core import Script

tasktiger/task.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020

2121
from ._internal import (
2222
ERROR,
23+
EXECUTIONS,
24+
EXECUTIONS_COUNT,
2325
QUEUED,
2426
SCHEDULED,
27+
TASK,
2528
g,
2629
gen_id,
2730
gen_unique_id,
@@ -30,7 +33,6 @@
3033
serialize_func_name,
3134
serialize_retry_method,
3235
)
33-
from .constants import EXECUTIONS, EXECUTIONS_COUNT, TASK
3436
from .exceptions import QueueFullException, TaskImportError, TaskNotFound
3537
from .runner import BaseRunner, get_runner_class
3638
from .types import RetryStrategy

tasktiger/worker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@
3636
from ._internal import (
3737
ACTIVE,
3838
ERROR,
39+
EXECUTIONS,
40+
EXECUTIONS_COUNT,
3941
QUEUED,
4042
SCHEDULED,
43+
TASK,
4144
dotted_parts,
4245
g,
4346
g_fork_lock,
@@ -47,7 +50,6 @@
4750
serialize_func_name,
4851
serialize_retry_method,
4952
)
50-
from .constants import EXECUTIONS, EXECUTIONS_COUNT, TASK
5153
from .exceptions import (
5254
RetryException,
5355
StopRetry,

0 commit comments

Comments
 (0)