tasktiger 0.19.2__tar.gz → 0.19.4__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.19.2/tasktiger.egg-info → tasktiger-0.19.4}/PKG-INFO +1 -1
- {tasktiger-0.19.2 → tasktiger-0.19.4}/setup.py +1 -1
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/__init__.py +0 -2
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/exceptions.py +15 -9
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/executor.py +19 -5
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/flask_script.py +0 -2
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/rollbar.py +0 -3
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/tasktiger.py +0 -2
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/timeouts.py +0 -8
- {tasktiger-0.19.2 → tasktiger-0.19.4/tasktiger.egg-info}/PKG-INFO +1 -1
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/tasks.py +4 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_lazy_init.py +0 -2
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_logging.py +0 -2
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_workers.py +26 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/LICENSE +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/MANIFEST.in +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/README.rst +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/pyproject.toml +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/setup.cfg +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/_internal.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/logging.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/lua/move_task.lua +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/lua/semaphore.lua +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/migrations.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/redis_scripts.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/redis_semaphore.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/retry.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/runner.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/schedule.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/stats.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/task.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/test_helpers.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/types.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/utils.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger/worker.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger.egg-info/SOURCES.txt +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger.egg-info/dependency_links.txt +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger.egg-info/entry_points.txt +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger.egg-info/requires.txt +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tasktiger.egg-info/top_level.txt +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/__init__.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/config.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/conftest.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/tasks_periodic.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_base.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_context_manager.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_migrations.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_periodic.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_queue_size.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_redis_scripts.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_semaphore.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_stats.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/test_task.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tests/utils.py +0 -0
- {tasktiger-0.19.2 → tasktiger-0.19.4}/tox.ini +0 -0
|
@@ -31,20 +31,26 @@ class StopRetry(Exception):
|
|
|
31
31
|
|
|
32
32
|
class RetryException(BaseException):
|
|
33
33
|
"""
|
|
34
|
-
Alternative to retry_on for retrying a task.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
Alternative to the `retry_on` parameter for retrying a task.
|
|
35
|
+
|
|
36
|
+
If this exception is raised within a task, the task will be retried as long
|
|
37
|
+
as the retry method permits.
|
|
38
|
+
|
|
39
|
+
The default retry method (specified in the task or in DEFAULT_RETRY_METHOD)
|
|
40
|
+
may be overridden using the method argument.
|
|
41
|
+
|
|
42
|
+
If original_traceback is True and RetryException is raised from within an
|
|
43
|
+
`except` block, the original traceback will be logged.
|
|
44
|
+
|
|
45
|
+
If `log_error` is set to False and the task fails permanently, a warning
|
|
46
|
+
will be logged instead of an error, and the task will be removed from Redis
|
|
47
|
+
when it completes.
|
|
42
48
|
"""
|
|
43
49
|
|
|
44
50
|
def __init__(
|
|
45
51
|
self,
|
|
46
52
|
method: Any = None,
|
|
47
|
-
original_traceback:
|
|
53
|
+
original_traceback: bool = False,
|
|
48
54
|
log_error: bool = True,
|
|
49
55
|
):
|
|
50
56
|
self.method = method
|
|
@@ -417,6 +417,8 @@ class SyncExecutor(Executor):
|
|
|
417
417
|
locks: Collection[Lock],
|
|
418
418
|
queue_lock: Optional[Semaphore],
|
|
419
419
|
) -> bool:
|
|
420
|
+
assert tasks
|
|
421
|
+
|
|
420
422
|
# Run heartbeat thread.
|
|
421
423
|
all_task_ids = {task.id for task in tasks}
|
|
422
424
|
stop_event = threading.Event()
|
|
@@ -433,11 +435,23 @@ class SyncExecutor(Executor):
|
|
|
433
435
|
)
|
|
434
436
|
heartbeat_thread.start()
|
|
435
437
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
+
serialized_task_func = tasks[0].serialized_func
|
|
439
|
+
for task in tasks:
|
|
440
|
+
log.info(
|
|
441
|
+
"processing",
|
|
442
|
+
func=serialized_task_func,
|
|
443
|
+
task_id=task.id,
|
|
444
|
+
params={"args": task.args, "kwargs": task.kwargs},
|
|
445
|
+
)
|
|
438
446
|
|
|
439
|
-
#
|
|
440
|
-
|
|
441
|
-
|
|
447
|
+
# Run the tasks.
|
|
448
|
+
try:
|
|
449
|
+
result = self.execute_tasks(tasks, log)
|
|
450
|
+
# Always stop the heartbeat thread -- even in case of an unhandled
|
|
451
|
+
# exception after running the task code, or when an unhandled
|
|
452
|
+
# BaseException is raised from within the task.
|
|
453
|
+
finally:
|
|
454
|
+
stop_event.set()
|
|
455
|
+
heartbeat_thread.join()
|
|
442
456
|
|
|
443
457
|
return result
|
|
@@ -19,6 +19,7 @@ from .tasks import (
|
|
|
19
19
|
long_task_ok,
|
|
20
20
|
simple_task,
|
|
21
21
|
sleep_task,
|
|
22
|
+
system_exit_task,
|
|
22
23
|
wait_for_long_task,
|
|
23
24
|
)
|
|
24
25
|
from .test_base import BaseTestCase
|
|
@@ -238,3 +239,28 @@ class TestSyncExecutorWorker:
|
|
|
238
239
|
assert task_lock_2 > DELAY
|
|
239
240
|
|
|
240
241
|
worker.kill()
|
|
242
|
+
|
|
243
|
+
def test_stop_heartbeat_thread_on_unhandled_exception(
|
|
244
|
+
self, tiger, ensure_queues
|
|
245
|
+
):
|
|
246
|
+
task = Task(tiger, system_exit_task)
|
|
247
|
+
task.delay()
|
|
248
|
+
|
|
249
|
+
# Start a worker and wait until it starts processing.
|
|
250
|
+
worker = Process(
|
|
251
|
+
target=external_worker,
|
|
252
|
+
kwargs={
|
|
253
|
+
"worker_kwargs": {
|
|
254
|
+
"executor_class": SyncExecutor,
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
)
|
|
258
|
+
worker.start()
|
|
259
|
+
|
|
260
|
+
# Ensure process exits and does not hang here.
|
|
261
|
+
worker.join()
|
|
262
|
+
|
|
263
|
+
# Since SystemExit derives from BaseException and is therefore not
|
|
264
|
+
# handled by the executor, the task is still active until it times out
|
|
265
|
+
# and gets requeued by another worker.
|
|
266
|
+
ensure_queues(active={"default": 1})
|
|
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
|