diff --git a/tasktiger/_internal.py b/tasktiger/_internal.py index 6f31d23..7b00b57 100644 --- a/tasktiger/_internal.py +++ b/tasktiger/_internal.py @@ -27,6 +27,11 @@ from .task import Task from .tasktiger import TaskTiger +# Constants pertaining to Redis keys +TASK = "task" +EXECUTIONS = "executions" +EXECUTIONS_COUNT = "executions_count" + # Task states (represented by different queues) # Note some client code may rely on the string values (e.g. get_queue_stats). QUEUED = "queued" diff --git a/tasktiger/constants.py b/tasktiger/constants.py deleted file mode 100644 index 6baf92d..0000000 --- a/tasktiger/constants.py +++ /dev/null @@ -1,11 +0,0 @@ -# constants pertaining to Redis keys -REDIS_PREFIX = "t" -TASK = "task" -EXECUTIONS = "executions" -EXECUTIONS_COUNT = "executions_count" - - -QUEUED = "queued" -ACTIVE = "active" -SCHEDULED = "scheduled" -ERROR = "error" diff --git a/tasktiger/migrations.py b/tasktiger/migrations.py index 3a80a2a..68bbb2c 100644 --- a/tasktiger/migrations.py +++ b/tasktiger/migrations.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from .constants import EXECUTIONS, TASK +from ._internal import EXECUTIONS, TASK from .utils import redis_glob_escape if TYPE_CHECKING: diff --git a/tasktiger/redis_scripts.py b/tasktiger/redis_scripts.py index 6c068e8..127e1ef 100644 --- a/tasktiger/redis_scripts.py +++ b/tasktiger/redis_scripts.py @@ -3,8 +3,15 @@ from redis import Redis -from ._internal import ACTIVE, ERROR, QUEUED, SCHEDULED -from .constants import EXECUTIONS, EXECUTIONS_COUNT, TASK +from ._internal import ( + ACTIVE, + ERROR, + EXECUTIONS, + EXECUTIONS_COUNT, + QUEUED, + SCHEDULED, + TASK, +) try: from redis.commands.core import Script diff --git a/tasktiger/task.py b/tasktiger/task.py index c723d32..0e08fc8 100644 --- a/tasktiger/task.py +++ b/tasktiger/task.py @@ -20,8 +20,11 @@ from ._internal import ( ERROR, + EXECUTIONS, + EXECUTIONS_COUNT, QUEUED, SCHEDULED, + TASK, g, gen_id, gen_unique_id, @@ -30,7 +33,6 @@ serialize_func_name, serialize_retry_method, ) -from .constants import EXECUTIONS, EXECUTIONS_COUNT, TASK from .exceptions import QueueFullException, TaskImportError, TaskNotFound from .runner import BaseRunner, get_runner_class from .types import RetryStrategy diff --git a/tasktiger/worker.py b/tasktiger/worker.py index b322540..9f944e4 100644 --- a/tasktiger/worker.py +++ b/tasktiger/worker.py @@ -36,8 +36,11 @@ from ._internal import ( ACTIVE, ERROR, + EXECUTIONS, + EXECUTIONS_COUNT, QUEUED, SCHEDULED, + TASK, dotted_parts, g, g_fork_lock, @@ -47,7 +50,6 @@ serialize_func_name, serialize_retry_method, ) -from .constants import EXECUTIONS, EXECUTIONS_COUNT, TASK from .exceptions import ( RetryException, StopRetry,