def test(task_id):
from app import celery
result = {'result': celery.submit(add_together, 2, 3).id}
On submit() I get the exception:
Traceback (most recent call last):
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 2464, in call
return self.wsgi_app(environ, start_response)
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/var/www/order/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/var/www/order/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/var/www/order/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/var/www/order/lib/python3.6/site-packages/flask_debugtoolbar/init.py", line 125, in dispatch_request
return view_func(req.view_args)
File "/var/www/order/app/routes/client.py", line 109, in test
result = {'result': celery.submit(add_together, 2, 3).id}
File "/var/www/order/lib/python3.6/site-packages/flask_execute/plugin.py", line 381, in submit
return self.apply(func, args=args, kwargs=kwargs, options)
File "/var/www/order/lib/python3.6/site-packages/flask_execute/plugin.py", line 398, in apply
self.start()
File "/var/www/order/lib/python3.6/site-packages/flask_execute/plugin.py", line 252, in start
running = self.status()
File "/var/www/order/lib/python3.6/site-packages/flask_execute/plugin.py", line 452, in status
output = cli.output('status', timeout=timeout)
File "/var/www/order/lib/python3.6/site-packages/flask_execute/cli.py", line 49, in output
return subprocess.check_output(args, stderr=stderr, env=os.environ.copy(), kwargs).decode('utf-8')
File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
kwargs).stdout
File "/usr/lib/python3.6/subprocess.py", line 423, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.6/subprocess.py", line 729, in init
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'celery': 'celery'
I can start celery from the venv folder without problem:
(order) ralfeus@sandlet /v/w/order> env FLASK_APP="app:create_app" flask celery worker
INFO:app:<class 'app.config.Config'>
INFO:app:None
INFO:app:Blueprints are registered
INFO:app:<class 'app.config.Config'>
INFO:app:None
INFO:app:Blueprints are registered
Weird but after I ran step by step debugging of process start it started normally and after that is working even without debugging and even after restart of the dev server
I initialize Celery app in my
__init__.py
:and then in my view function:
On submit() I get the exception:
I can start celery from the venv folder without problem:
So I'm not sure how do I start celery