sabiroid opened a new pull request #16284:
URL: https://github.com/apache/superset/pull/16284
### SUMMARY
As explained in #16209, original Flask context is not present on the Celery
workers. Because of that, some crucial information like granular source or
access token are not reachable for establishing a proper DB connection. This PR
ads two functions to the config allowing to materialize some global Flask
properties into the Celery request on the requestor side and then dematerialize
them back into the global environment on the Celery worker side, thus allowing
DB_CONNECTION_MUTATOR to always have all required information.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
n/a
### TESTING INSTRUCTIONS
1. Define some simple metadata passover functions (e.g.
`CELERY_FLASK_METADATA_EXTRACTOR` getting some field from `flask.request` and
`CELERY_FLASK_METADATA_INITIALIZER` putting this data somewhere in `flask.g`)
2. Run a query from the Superset SQL Lab locally with a breakpoint on the
Celery worker side.
3. Check `flask.g` contains an expected parameter.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Implements #16209
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]