<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li>[] I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><p dir="auto">software -&gt; celery:5.0.1 (singularity) kombu:5.0.2 py:3.8.6<br>
billiard:3.6.3.0 redis:3.5.3<br>
platform -&gt; system:Linux arch:64bit, ELF<br>
kernel version:4.14.200-155.322.amzn2.x86_64 imp:CPython<br>
loader   -&gt; celery.loaders.app.AppLoader<br>
settings -&gt; transport:redis results:****************</p>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: 5.0.1</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">I think we are supposed to be able to run celery multi start in other directories with --workdir option passed.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">After upgrading to 5.0.1 from 4.x, the celery multi start command stopped working when not running from the workdir, even with workdir option passed in the command. The daemon service could not start as a result.</p>
<p dir="auto">/opt/Cranberry/venv/bin/celery multi start worker1 --workdir=/opt/Cranberry/ --app=Cranberry</p>
<p dir="auto">Error from the command above:<br>
Error: Invalid value for '-A' / '--app':<br>
Unable to load celery application.<br>
Module 'cranberry' has no attribute 'celery'<br>
&gt; <a href="mailto:worker1@ip-10-0-5-210.ec2.internal">worker1@ip-10-0-5-210.ec2.internal</a>: * Child terminated with exit code 2<br>
FAILED</p>
<p dir="auto">I inserted print('Workdir: ', workdir) at:  </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/celery/celery/blob/7c3da03a07882ca86b801ad78dd509a67cba60af/celery/bin/celery.py#L123">celery/celery/bin/celery.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 123
      in
      <a data-pjax="true" class="commit-tease-sha" href="/celery/celery/commit/7c3da03a07882ca86b801ad78dd509a67cba60af">7c3da03</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L123" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="123"></td>
          <td id="LC123" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
And it prints:<br>
Workdir:  None<p></p>
<p dir="auto">Any help on this is much appreciated!</p>
<p dir="auto">Updates 14:50:<br>
Tried to debug it a little more and it seems multi ends up calling subprocess with "celery --app=Cranberry worker --workdir=/opt/Cranberry/ ..."<br>
The command goes to celery.bin.celery.APP.convert.<br>
I tried to print ctx.params there, and notice that the --workdir param only shows up when it's before --app in command:</p>
<blockquote>
<p dir="auto">(venv) 2 ec2-user@ip:/opt$ celery --app=Cranberry --workdir=/opt/Cranberry/ worker<br>
app convert:  Cranberry {}<br>
Usage: celery [OPTIONS] COMMAND [ARGS]...</p>
<p dir="auto">Error: Invalid value for '-A' / '--app':<br>
Unable to load celery application.<br>
The module Cranberry was not found.</p>
<p dir="auto">(venv) 2 ec2-user@:/opt$ celery --workdir=/opt/Cranberry/ --app=Cranberry worker<br>
app convert:  Cranberry {'workdir': '/opt/Cranberry/'}<br>
Usage: celery [OPTIONS] COMMAND [ARGS]...</p>
<p dir="auto">Error: Invalid value for '-A' / '--app':</p>
</blockquote>
<p dir="auto">And this params does not seem to be used in os.chdir or get passed to find_app.</p>
<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<p dir="auto">Make a task fail with an unhandled exception and see exception getting exception while handling the exception throwing the exception again.</p>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">Expecting to get exception one time and resolve with job failure.</p>
<h1 dir="auto">Actual Behavior</h1>

<blockquote>
<p dir="auto">[2020-11-23 17:33:17,485: ERROR/ForkPoolWorker-1] Chord 'f8c9088d-5340-496e-bbec-eab167c43ac1' raised: ValueError('could not broadcast input array from shape (3,336,244) into shape (3,336,256)')<br>
Traceback (most recent call last):<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/trace.py", line 409, in trace_task<br>
R = retval = fun(*args, **kwargs)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/trace.py", line 701, in <strong>protected_call</strong><br>
return self.run(*args, **kwargs)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/autoretry.py", line 54, in run<br>
ret = task.retry(exc=exc, **retry_kwargs)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/task.py", line 703, in retry<br>
raise_with_context(exc)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/autoretry.py", line 34, in run<br>
return task._orig_run(*args, **kwargs)<br>
File "/var/www/django_projects/earthalytics-api/api_v3/nodes/BuildingsClassification50cm.py", line 38, in execute<br>
predictor.predict(input_path, output_path)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/rasterprediction/predictor.py", line 94, in predict<br>
labels = inferer.predict(x)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/rasterprediction/backend/inferer.py", line 160, in predict<br>
temp[:x.shape[0], :x.shape[1]] = x<br>
ValueError: could not broadcast input array from shape (3,336,244) into shape (3,336,256)</p>
<p dir="auto">During handling of the above exception, another exception occurred:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/django_celery_results/backends/database.py", line 147, in trigger_callback<br>
ret = j(timeout=app.conf.result_chord_join_timeout, propagate=True)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 746, in join<br>
value = result.get(<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 219, in get<br>
self.maybe_throw(callback=callback)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 335, in maybe_throw<br>
self.throw(value, self._to_remote_traceback(tb))<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 328, in throw<br>
self.on_ready.throw(*args, **kwargs)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/vine/promises.py", line 234, in throw<br>
reraise(type(exc), exc, tb)<br>
File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/vine/utils.py", line 30, in reraise<br>
raise value<br>
ValueError: could not broadcast input array from shape (3,336,244) into shape (3,336,256)</p>
</blockquote>