bouk opened a new issue, #36892:
URL: https://github.com/apache/superset/issues/36892

   ### Bug description
   
   I'm running the alerts and reports celery worker as follows: `celery 
--app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4`
   
   On every job (e.g. on the minute from the beat) I get an exception in the 
logs, as below. I'm not sure it causes any issues.
   
   ### Screenshots/recordings
   
   ```
   Jan 03 17:31:00 celery [2026-01-03 17:31:00,019: ERROR/MainProcess] Signal 
handler <function teardown at 0x7f09077da520> raised: RuntimeError('Working 
outside of application context.\n\nThis typically means that you attempted to 
use functionality that needed\nthe current application. To solve this, set up 
an application context\nwith app.app_context(). See the documentation for more 
information.')
   Jan 03 17:31:00 celery Traceback (most recent call last):
   Jan 03 17:31:00 celery   File 
"/nix/store/8z13kf9snjgs5nwvrvbn8sh4nwngz9vs-superset/lib/python3.12/site-packages/celery/utils/dispatch/signal.py",
 line 280, in send
   Jan 03 17:31:00 celery     response = receiver(signal=self, sender=sender, 
**named)
   Jan 03 17:31:00 celery                
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   Jan 03 17:31:00 celery   File 
"/nix/store/8z13kf9snjgs5nwvrvbn8sh4nwngz9vs-superset/lib/python3.12/site-packages/superset/tasks/celery_app.py",
 line 71, in teardown
   Jan 03 17:31:00 celery     db.session.remove()
   Jan 03 17:31:00 celery   File 
"/nix/store/8z13kf9snjgs5nwvrvbn8sh4nwngz9vs-superset/lib/python3.12/site-packages/sqlalchemy/orm/scoping.py",
 line 180, in remove
   Jan 03 17:31:00 celery     if self.registry.has():
   Jan 03 17:31:00 celery        ^^^^^^^^^^^^^^^^^^^
   Jan 03 17:31:00 celery   File 
"/nix/store/8z13kf9snjgs5nwvrvbn8sh4nwngz9vs-superset/lib/python3.12/site-packages/sqlalchemy/util/_collections.py",
 line 1015, in has
   Jan 03 17:31:00 celery     return self.scopefunc() in self.registry
   Jan 03 17:31:00 celery            ^^^^^^^^^^^^^^^^
   Jan 03 17:31:00 celery   File 
"/nix/store/8z13kf9snjgs5nwvrvbn8sh4nwngz9vs-superset/lib/python3.12/site-packages/flask_sqlalchemy/session.py",
 line 102, in _app_ctx_id
   Jan 03 17:31:00 celery     return id(app_ctx._get_current_object())  # type: 
ignore[attr-defined]
   Jan 03 17:31:00 celery               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   Jan 03 17:31:00 celery   File 
"/nix/store/8z13kf9snjgs5nwvrvbn8sh4nwngz9vs-superset/lib/python3.12/site-packages/werkzeug/local.py",
 line 519, in _get_current_object
   Jan 03 17:31:00 celery     raise RuntimeError(unbound_message) from None
   Jan 03 17:31:00 celery RuntimeError: Working outside of application context.
   Jan 03 17:31:00 celery This typically means that you attempted to use 
functionality that needed
   Jan 03 17:31:00 celery the current application. To solve this, set up an 
application context
   Jan 03 17:31:00 celery with app.app_context(). See the documentation for 
more information.
   ```
   
   ### Superset version
   
   6.0.0
   
   ### Python version
   
   Not applicable
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   Python 3.12
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to