I more or less use the setting to run Celery tasks using the flash application context here: http://flask.pocoo.org/docs/0.10/patterns/celery/
I get the same error message that Create, manage and kill background tasks in a flash application
but, I get it at the actual worker where the Celery task is performed. Here is the trace:
worker_1 | Traceback (most recent call last):
worker_1 | File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
worker_1 | R = retval = fun(*args, **kwargs)
worker_1 | File "/code/app/__init__.py", line 42, in __call__
worker_1 | return TaskBase.__call__(self, *args, **kwargs)
worker_1 | File "/usr/local/lib/python2.7/dist-packages/flask/ctx.py", line 186, in __exit__
worker_1 | self.pop(exc_value)
worker_1 | File "/usr/local/lib/python2.7/dist-packages/flask/ctx.py", line 178, in pop
worker_1 | % (rv, self)
worker_1 | AssertionError: Popped wrong app context. (<flask.ctx.AppContext object at 0x47a5790> instead of <flask.ctx.AppContext object at 0x427e390>)
Does anyone have any ideas? Running in the context of the application should fix this problem, not create it!
thank
source
share