robdiciuccio opened a new issue #8651: Async queries failing in celery workers URL: https://github.com/apache/incubator-superset/issues/8651 When running a query in SQL Lab against a database with async queries enabled, the following error is raised by the celery worker: ``` Task sql_lab.get_sql_results[051acb0d-30a5-4dbe-b30e-5b16bc9d8545] raised unexpected: RuntimeError('Working outside of application context.\n\nThis typically means that you attempted to use functionality that needed\nto interface with the current application object in some way. To solve\nthis, set up an application context with app.app_context(). See the\ndocumentation for more information.',) Traceback (most recent call last): File "/Users/rob/work/incubator-superset/venv/lib/python3.6/site-packages/celery/app/trace.py", line 385, in trace_task R = retval = fun(*args, **kwargs) File "/Users/rob/work/incubator-superset/venv/lib/python3.6/site-packages/celery/app/trace.py", line 648, in __protected_call__ return self.run(*args, **kwargs) File "/Users/rob/work/incubator-superset/superset/sql_lab.py", line 154, in get_sql_results with session_scope(not ctask.request.called_directly) as session: File "/Users/rob/work/incubator-superset/venv/lib/python3.6/site-packages/contextlib2.py", line 79, in __enter__ return next(self.gen) File "/Users/rob/work/incubator-superset/superset/sql_lab.py", line 117, in session_scope app.config["SQLALCHEMY_DATABASE_URI"], poolclass=NullPool File "/Users/rob/work/incubator-superset/venv/lib/python3.6/site-packages/werkzeug/local.py", line 348, in __getattr__ return getattr(self._get_current_object(), name) File "/Users/rob/work/incubator-superset/venv/lib/python3.6/site-packages/werkzeug/local.py", line 307, in _get_current_object return self.__local() File "/Users/rob/work/incubator-superset/venv/lib/python3.6/site-packages/flask/globals.py", line 52, in _find_app raise RuntimeError(_app_ctx_err_msg) RuntimeError: Working outside of application context. This typically means that you attempted to use functionality that needed to interface with the current application object in some way. To solve this, set up an application context with app.app_context(). See the documentation for more information. ``` ### Expected results Celery worker should run the query and store the results in the RESULTS_BACKEND. ### Actual results Exception raised (see above). #### Screenshots If applicable, add screenshots to help explain your problem. #### How to reproduce the bug 1. Go to SQL Lab 2. Run a query against a database with Asynchronous Query Operation enabled 3. Note that the UI hangs and a result is never returned 4. Celery worker raises the above error ### Environment (please complete the following information): - superset version: master (acf0753504095a5c0e320b049370aaf6f04e5a4f) - python version: 3.6.8 - node.js version: v12.4.0 - npm version: 6.9.0 ### Checklist Make sure these boxes are checked before submitting your issue - thank you! - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [x] I have reproduced the issue with at least the latest released version of superset. - [x] I have checked the issue tracker for the same issue and I haven't found one similar. ### Additional context Per @craig-rueda, may be related to application context changes in https://github.com/apache/incubator-superset/pull/8418
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
