-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Worker can't do impersonation while enable global async #13378
Comments
I noticed that username should be get by superset/utils/core/get_username() line 1308. |
Tested with webserver, it's possible to get username:
can it be possible that celery worker didn't register in flask context? |
Same happened to us while GLOBAL_ASYNC_QUERIES is turned on. We are running Impala with impersonation, and the problem seemed to be that when function get_sqla_engine() in models/core.py is called, self.impersonate_user is True, but the argument user_name is None. The username is then attempted to get extracted from get_effective_username() in models/core.py, but that fails because: g.user is not an attribute of g (AttributeError: '_AppCtxGlobals' object has no attribute 'user'). |
Hi @robdiciuccio @gorcurek , I might have a workaround to fix this. Inspired by https://stackoverflow.com/questions/21138025/attributeerror-appctxglobals-object-has-no-attribute-user-in-flask and errors from gorcurek , I changed model/core.py with:
I will test more next Monday and appreciate if you can have a test too also and share your opinions. Thanks! |
I tested but not fixing this issue. Will try something else or wait for official fix. |
@benjreinhart is working on a fix for this currently |
We enabled impersonation on Presto, Hive, impala.... etc sources and enabled global async in superset 1.0.0. However, worker can't get effective_username and queries will be run as system user
Expected results
Dashboard query can be run as actual login user of superset when datasource enabled impersonation.
Actual results
Dashboard will be run as system user no matter impersonation is on in datasource.
Screenshots
I added logger in superset/models/core.py line 289, line 301 to debug. svc_acc_bdp_superset is a linux user which run celery workers
How to reproduce the bug
Environment
(please complete the following information):
Superset 1.0.0
Python 3.8.2
Flask 1.1.2
PyHive 0.6.2
celery 4.4.7
Checklist
Make sure to follow these steps before submitting your issue - thank you!
Additional context
stacktraces:
worker systemctl:
The text was updated successfully, but these errors were encountered: