Repository navigation
Open
Description
It appears as though the disable_sync_subtasks setting doesn't get propagated sometimes (I get intermittent errors).
Environment & Settings
Celery version: 4.2.1
Steps to Reproduce
Minimally Reproducible Test Case
@unignored_task(bind=True)
def orchestrate_get_all_issues(self, sync_class: str):
save = save_all_issues(sync_class)
get = _get_all_issues.si(sync_class)
process = process_issues.s(sync_class)
return (save | get | process)().get(disable_sync_subtasks=False)
def save_all_issues(sync_class: str):
needs_saving = sync_mapping[sync_class].model.objects.needs_saving() \
.values_list('key', flat=True)
g = group(save_one_issue.s(sync_class, key) for key in needs_saving)
return g
@unignored_task(bind=True)
def _get_all_issues(self, sync_class: str):
g = group(get_many_issues.si(sync_class, start, 1000) for start in
range(0, max_issues, 1000))
try:
self.replace(chord(g, to_process.s()))
except Ignore:
return
@unignored_task(bind=True)
def process_issues(self, needs_processing: list, sync_class: str):
if not needs_processing:
needs_processing = []
g = group(process_one_issue.si(sync_class, item)
for item in needs_processing)
try:
self.replace(g)
except Ignore:
return
def unignored_task(method=None, **kwargs) -> Callable:
def simple_real_decorator(func: Callable):
@task(ignore_result=False, max_retries=1, **kwargs)
@wraps(func)
def wrapper(*run_args, **run_kwargs):
return func(*run_args, **run_kwargs)
return wrapper
if method:
return simple_real_decorator(method)
return simple_real_decoratorExpected Behavior
The task runs successfully, with the acceptance of possible deadlock
Actual Behavior
Raised error: Never call result.get() within a task! See http://docs.celeryq.org/en/latest/userguide/tasks.html#task-synchronous-subtasks
File "/PATH/some_file.py", in orchestrate_get_all_issues return (save | get | process)().get(disable_sync_subtasks=False)
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 224, in get on_message=on_message,
File "/PATH/lib/python3.6/site-packages/celery/backends/async.py", line 188, in wait_for_pending for _ in self._wait_for_pending(result, **kwargs):
File "/PATH/lib/python3.6/site-packages/celery/backends/async.py", line 255, in _wait_for_pending on_interval=on_interval):
File "/PATH/lib/python3.6/site-packages/celery/backends/async.py", line 56, in drain_events_until yield self.wait_for(p, wait, timeout=1)
File "/PATH/lib/python3.6/site-packages/celery/backends/async.py", line 65, in wait_for wait(timeout=timeout)
File "/PATH/lib/python3.6/site-packages/celery/backends/redis.py", line 121, in drain_events self.on_state_change(self._decode_result(m['data']), m)
File "/PATH/lib/python3.6/site-packages/celery/backends/redis.py", line 100, in on_state_change super(ResultConsumer, self).on_state_change(meta, message)
File "/PATH/lib/python3.6/site-packages/celery/backends/async.py", line 289, in on_state_change result._maybe_set_cache(meta)
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 404, in _maybe_set_cache self.on_ready(self)
File "/PATH/lib/python3.6/site-packages/vine/promises.py", line 150, in __call__ svpending(*ca, **ck)
File "/PATH/lib/python3.6/site-packages/vine/synchronization.py", line 67, in __call__ self.p(*self.args, **self.kwargs)
File "/PATH/lib/python3.6/site-packages/vine/promises.py", line 150, in __call__ svpending(*ca, **ck)
File "/PATH/lib/python3.6/site-packages/vine/promises.py", line 143, in __call__ return self.throw()
File "/PATH/lib/python3.6/site-packages/vine/promises.py", line 140, in __call__ retval = fun(*final_args, **final_kwargs)
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 877, in _on_ready ResultSet._on_ready(self)
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 519, in _on_ready self._cache = [r.get() for r in self.results]
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 519, in self._cache = [r.get() for r in self.results]
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 203, in get assert_will_not_block()
File "/PATH/lib/python3.6/site-packages/celery/result.py", line 41, in assert_will_not_block raise RuntimeError(E_WOULDBLOCK)
Activity
auvipy commentedon May 11, 2019
whats its update on celery 4.3