tasktiger 0.26.0__tar.gz → 0.26.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tasktiger-0.26.0/tasktiger.egg-info → tasktiger-0.26.1}/PKG-INFO +1 -1
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/__init__.py +1 -1
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/task.py +13 -7
- {tasktiger-0.26.0 → tasktiger-0.26.1/tasktiger.egg-info}/PKG-INFO +1 -1
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_base.py +29 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/LICENSE +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/MANIFEST.in +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/README.rst +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/pyproject.toml +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/setup.cfg +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/setup.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/_internal.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/exceptions.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/executor.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/flask_script.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/logging.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/lua/move_task.lua +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/lua/semaphore.lua +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/migrations.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/redis_scripts.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/redis_semaphore.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/retry.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/rollbar.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/runner.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/schedule.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/stats.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/tasktiger.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/test_helpers.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/timeouts.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/types.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/utils.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger/worker.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger.egg-info/SOURCES.txt +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger.egg-info/dependency_links.txt +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger.egg-info/entry_points.txt +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger.egg-info/requires.txt +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tasktiger.egg-info/top_level.txt +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/__init__.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/config.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/conftest.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/tasks.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/tasks_periodic.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_context_manager.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_lazy_init.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_logging.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_migrations.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_periodic.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_queue_size.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_redis_scripts.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_semaphore.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_stats.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_task.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/test_workers.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tests/utils.py +0 -0
- {tasktiger-0.26.0 → tasktiger-0.26.1}/tox.ini +0 -0
|
@@ -513,15 +513,19 @@ class Task:
|
|
|
513
513
|
tiger: TaskTiger instance.
|
|
514
514
|
queue: Name of the queue.
|
|
515
515
|
state: State of the task (QUEUED, ACTIVE, SCHEDULED, ERROR).
|
|
516
|
+
skip: Number of latest tasks to pass over.
|
|
516
517
|
limit: Maximum number of tasks to return.
|
|
517
518
|
load_executions: Maximum number of executions to load for each task
|
|
518
519
|
(starting from the latest).
|
|
519
|
-
include_not_found: Whether to include tasks that
|
|
520
|
+
include_not_found: Whether to include tasks that have no payload.
|
|
520
521
|
|
|
521
522
|
Returns:
|
|
522
523
|
Tuple with the following information:
|
|
523
|
-
* total items in the queue
|
|
524
|
-
*
|
|
524
|
+
* total items in the queue, including tasks without a payload
|
|
525
|
+
* the latest `limit` tasks after the latest `skip` tasks, in
|
|
526
|
+
ascending order of score. If tasks without a payload are left
|
|
527
|
+
out, this list can be shorter than `limit` before the end of the
|
|
528
|
+
queue.
|
|
525
529
|
"""
|
|
526
530
|
|
|
527
531
|
key = tiger._key(state, queue)
|
|
@@ -549,8 +553,9 @@ class Task:
|
|
|
549
553
|
range(len(items)), results[0], results[1:], tss
|
|
550
554
|
):
|
|
551
555
|
if serialized_data is None:
|
|
552
|
-
if include_not_found:
|
|
553
|
-
|
|
556
|
+
if not include_not_found:
|
|
557
|
+
continue
|
|
558
|
+
data = {"id": items[idx][0]}
|
|
554
559
|
else:
|
|
555
560
|
data = json.loads(serialized_data)
|
|
556
561
|
|
|
@@ -572,8 +577,9 @@ class Task:
|
|
|
572
577
|
)
|
|
573
578
|
for idx, serialized_data, ts in zip(range(len(items)), result, tss):
|
|
574
579
|
if serialized_data is None:
|
|
575
|
-
if include_not_found:
|
|
576
|
-
|
|
580
|
+
if not include_not_found:
|
|
581
|
+
continue
|
|
582
|
+
data = {"id": items[idx][0]}
|
|
577
583
|
else:
|
|
578
584
|
data = json.loads(serialized_data)
|
|
579
585
|
|
|
@@ -1072,6 +1072,35 @@ class TestTasks(BaseTestCase):
|
|
|
1072
1072
|
assert n == 1
|
|
1073
1073
|
assert len(tasks[0].executions) == 2
|
|
1074
1074
|
|
|
1075
|
+
@pytest.mark.parametrize("load_executions", [0, 1])
|
|
1076
|
+
@pytest.mark.parametrize("missing_index", [0, 1, 2])
|
|
1077
|
+
def test_tasks_from_queue_task_not_found(self, load_executions, missing_index):
|
|
1078
|
+
tasks = [Task(self.tiger, simple_task) for _ in range(3)]
|
|
1079
|
+
# Distinct scheduled times give a fixed order in the zset.
|
|
1080
|
+
for minutes, task in enumerate(tasks, start=1):
|
|
1081
|
+
task.delay(when=datetime.timedelta(minutes=minutes))
|
|
1082
|
+
missing_task = tasks[missing_index]
|
|
1083
|
+
self.conn.delete(self.tiger._key("task", missing_task.id))
|
|
1084
|
+
|
|
1085
|
+
n, found = Task.tasks_from_queue(
|
|
1086
|
+
self.tiger, "default", "scheduled", load_executions=load_executions
|
|
1087
|
+
)
|
|
1088
|
+
assert n == 3
|
|
1089
|
+
assert [task.id for task in found] == [
|
|
1090
|
+
task.id for task in tasks if task is not missing_task
|
|
1091
|
+
]
|
|
1092
|
+
|
|
1093
|
+
n, found = Task.tasks_from_queue(
|
|
1094
|
+
self.tiger,
|
|
1095
|
+
"default",
|
|
1096
|
+
"scheduled",
|
|
1097
|
+
load_executions=load_executions,
|
|
1098
|
+
include_not_found=True,
|
|
1099
|
+
)
|
|
1100
|
+
assert n == 3
|
|
1101
|
+
assert [task.id for task in found] == [task.id for task in tasks]
|
|
1102
|
+
assert found[missing_index].data == {"id": missing_task.id}
|
|
1103
|
+
|
|
1075
1104
|
def test_eager(self):
|
|
1076
1105
|
self.tiger.config["ALWAYS_EAGER"] = True
|
|
1077
1106
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|