<p dir="auto">Celery version 4.2.0</p>
<p dir="auto">I want to get results of tasks in group.<br>
In development i'm using a CELERY_ALWAYS_EAGER=True.<br>
If i run code below:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@shared_task
def task_in_group():
    return &quot;something&quot;

@shared_task
def task_finishing_chain(results):
    return results

@shared_task
def task_launcher():
    chain_tasks = chain(
        group(
            task_in_group.si(),
            task_in_group.si()
        ),
        task_finishing_chain.s())
    chain_tasks.apply_async()

def run_tasks():
    task_launcher.apply_async()"><pre class="notranslate"><code class="notranslate">@shared_task
def task_in_group():
    return "something"

@shared_task
def task_finishing_chain(results):
    return results

@shared_task
def task_launcher():
    chain_tasks = chain(
        group(
            task_in_group.si(),
            task_in_group.si()
        ),
        task_finishing_chain.s())
    chain_tasks.apply_async()

def run_tasks():
    task_launcher.apply_async()
</code></pre></div>
<p dir="auto">then i'm getting the following exception:</p>
<pre class="notranslate">Task my_app.tasks.task_in_group[36c33a48-3047-4be8-82f1-70b985e87980] succeeded in 0.00011961600012000417s: 'something'
Task my_app.tasks.task_in_group[1e3a13c3-fbb7-4535-bf68-3f988a331a42] succeeded in 3.561300013643631e-05s: 'something'
Task my_app.tasks.task_launcher[0fbbae47-f3fc-4a2d-b2ce-b10c8e91182c] raised unexpected: RuntimeError('Never call result.get() within a task!\nSee http://docs.celeryq.org/en/latest/userguide/tasks.html#task-synchronous-subtasks\n',)
Traceback (most recent call last):
  File "/home/vagrant/python35/lib/python3.5/site-packages/celery/app/trace.py", line 382, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/vagrant/my_app/tasks.py", line 268, in task_launcher
    chain_tasks.apply_async()
  File "/home/vagrant/python35/lib/python3.5/site-packages/celery/canvas.py", line 1230, in apply_async
    body=body, task_id=task_id, **options)
  File "/home/vagrant/python35/lib/python3.5/site-packages/celery/canvas.py", line 1239, in apply
    args=(tasks.apply(args, kwargs).get(propagate=propagate),),
  File "/home/vagrant/python35/lib/python3.5/site-packages/celery/result.py", line 671, in get
    on_interval=on_interval,
  File "/home/vagrant/python35/lib/python3.5/site-packages/celery/result.py", line 722, in join
    assert_will_not_block()
  File "/home/vagrant/python35/lib/python3.5/site-packages/celery/result.py", line 41, in assert_will_not_block
    raise RuntimeError(E_WOULDBLOCK)
RuntimeError: Never call result.get() within a task!
</pre>
<p dir="auto">On production everything works normally with CELERY_ALWAYS_EAGER=False.</p>
<p dir="auto"><code class="notranslate">Task.retry()</code> always raises a <code class="notranslate">RuntimeError</code> if <code class="notranslate">task_always_eager</code> and <code class="notranslate">task_eager_propagates</code> are set to <code class="notranslate">True</code>. This is counterintuitive. I would expect this example to work:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from celery import Celery

app = Celery(__name__,
             config_source=dict(task_always_eager=True,
                                task_eager_propagates=True))

@app.task(bind=True, default_retry_delay=1, max_retries=None, shared=False)
def foo(self, i):
    if i &lt;= 0:
        return 'Task succeeded!'
    else:
        self.retry((i - 1,))


foo.delay(3)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-v">Celery</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>(<span class="pl-s1">__name__</span>,
             <span class="pl-s1">config_source</span><span class="pl-c1">=</span><span class="pl-en">dict</span>(<span class="pl-s1">task_always_eager</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
                                <span class="pl-s1">task_eager_propagates</span><span class="pl-c1">=</span><span class="pl-c1">True</span>))

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">task</span>(<span class="pl-s1">bind</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">default_retry_delay</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">max_retries</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">shared</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">foo</span>(<span class="pl-s1">self</span>, <span class="pl-s1">i</span>):
    <span class="pl-k">if</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;=</span> <span class="pl-c1">0</span>:
        <span class="pl-k">return</span> <span class="pl-s">'Task succeeded!'</span>
    <span class="pl-k">else</span>:
        <span class="pl-s1">self</span>.<span class="pl-en">retry</span>((<span class="pl-s1">i</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>,))


<span class="pl-s1">foo</span>.<span class="pl-en">delay</span>(<span class="pl-c1">3</span>)</pre></div>
<p dir="auto">But instead it raises this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
    ...
    raise RuntimeError(E_WOULDBLOCK)
RuntimeError: Never call result.get() within a task!
See http://docs.celeryq.org/en/latest/userguide/tasks.html#task-synchronous-subtasks"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
    ...
    raise RuntimeError(E_WOULDBLOCK)
RuntimeError: Never call result.get() within a task!
See http://docs.celeryq.org/en/latest/userguide/tasks.html#task-synchronous-subtasks
</code></pre></div>
<p dir="auto">This can be reproduced on master and with 4.2.0rc2.</p>