Issue 1:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group first.

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

[] I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Environment & Settings

Celery version:

celery report Output:

software -> celery:5.0.1 (singularity) kombu:5.0.2 py:3.8.6

billiard:3.6.3.0 redis:3.5.3

platform -> system:Linux arch:64bit, ELF

kernel version:4.14.200-155.322.amzn2.x86_64 imp:CPython

loader -> celery.loaders.app.AppLoader

settings -> transport:redis results:****************

Steps to Reproduce

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: 5.0.1

Minimal Kombu Version: N/A or Unknown

Minimal Broker Version: N/A or Unknown

Minimal Result Backend Version: N/A or Unknown

Minimal OS and/or Kernel Version: N/A or Unknown

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

I think we are supposed to be able to run celery multi start in other directories with --workdir option passed.

Actual Behavior

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.

/opt/Cranberry/venv/bin/celery multi start worker1 --workdir=/opt/Cranberry/ --app=Cranberry

Error from the command above:

Error: Invalid value for '-A' / '--app':

Unable to load celery application.

Module 'cranberry' has no attribute 'celery'

> worker1@ip-10-0-5-210.ec2.internal: * Child terminated with exit code 2

FAILED

I inserted print('Workdir: ', workdir) at:

celery/celery/bin/celery.py

Line 123
in
7c3da03

And it prints:

Workdir: None

Any help on this is much appreciated!

Updates 14:50:

Tried to debug it a little more and it seems multi ends up calling subprocess with "celery --app=Cranberry worker --workdir=/opt/Cranberry/ ..."

The command goes to celery.bin.celery.APP.convert.

I tried to print ctx.params there, and notice that the --workdir param only shows up when it's before --app in command:

(venv) 2 ec2-user@ip:/opt$ celery --app=Cranberry --workdir=/opt/Cranberry/ worker

app convert: Cranberry {}

Usage: celery [OPTIONS] COMMAND [ARGS]...

Error: Invalid value for '-A' / '--app':

Unable to load celery application.

The module Cranberry was not found.

(venv) 2 ec2-user@:/opt$ celery --workdir=/opt/Cranberry/ --app=Cranberry worker

app convert: Cranberry {'workdir': '/opt/Cranberry/'}

Usage: celery [OPTIONS] COMMAND [ARGS]...

Error: Invalid value for '-A' / '--app':

And this params does not seem to be used in os.chdir or get passed to find_app.

Issue 2:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group first.

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Environment & Settings

Celery version:

celery report Output:

Steps to Reproduce

Make a task fail with an unhandled exception and see exception getting exception while handling the exception throwing the exception again.

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: N/A or Unknown

Minimal Kombu Version: N/A or Unknown

Minimal Broker Version: N/A or Unknown

Minimal Result Backend Version: N/A or Unknown

Minimal OS and/or Kernel Version: N/A or Unknown

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

Expecting to get exception one time and resolve with job failure.

Actual Behavior

[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)')

Traceback (most recent call last):

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/trace.py", line 409, in trace_task

R = retval = fun(*args, **kwargs)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/trace.py", line 701, in protected_call

return self.run(*args, **kwargs)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/autoretry.py", line 54, in run

ret = task.retry(exc=exc, **retry_kwargs)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/task.py", line 703, in retry

raise_with_context(exc)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/app/autoretry.py", line 34, in run

return task._orig_run(*args, **kwargs)

File "/var/www/django_projects/earthalytics-api/api_v3/nodes/BuildingsClassification50cm.py", line 38, in execute

predictor.predict(input_path, output_path)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/rasterprediction/predictor.py", line 94, in predict

labels = inferer.predict(x)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/rasterprediction/backend/inferer.py", line 160, in predict

temp[:x.shape[0], :x.shape[1]] = x

ValueError: could not broadcast input array from shape (3,336,244) into shape (3,336,256)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/django_celery_results/backends/database.py", line 147, in trigger_callback

ret = j(timeout=app.conf.result_chord_join_timeout, propagate=True)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 746, in join

value = result.get(

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 219, in get

self.maybe_throw(callback=callback)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 335, in maybe_throw

self.throw(value, self._to_remote_traceback(tb))

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/celery/result.py", line 328, in throw

self.on_ready.throw(*args, **kwargs)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/vine/promises.py", line 234, in throw

reraise(type(exc), exc, tb)

File "/home/ubuntu/venvs/earthalytics-api/lib/python3.8/site-packages/vine/utils.py", line 30, in reraise

raise value

ValueError: could not broadcast input array from shape (3,336,244) into shape (3,336,256)