-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
Skeleton for remote query execution using celery. #759
Conversation
return content | ||
|
||
@celery_app.task | ||
def get_sql_results_async(database_id, sql): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you could just have a single function get_sql_results
decorated with @celery_app.task
, and you can call it with .async
where needed (on an alternative endpoint)
c_worker.run(**options) | ||
|
||
|
||
if config.get('CELERY_CONFIG'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't put this in module scope, it will print on import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't cleaned up after debugging, sorry.
This is really just a mock up written in React to try different components. It could become scaffolding to build a prototype, or not.
} | ||
return json.dumps(data, default=utils.json_int_dttm_ser, allow_nan=False) | ||
if 'tmp_table' in data: | ||
# TODO(bkyryliuk) implement retrieving the data from tmp table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would assume waiting for the table which isn't what we want to do here, we can remove 1302 and 1303
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated todo to be:
# TODO(bkyryliuk): add query id to the response and implement the endpoint to poll the status and results.
eng.execute(sql) | ||
return { | ||
'tmp_table': tmp_table_name, | ||
'success': True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+trailing comma
1. move translation, connection, query to core (apache#729) 2. update encodable to remove formatter inter-dependency (apache#744) 3. move number-format and time-format to core (apache#730) 4. move superset-ui/dimension to core (apache#732) 5. move superset-ui/color to core (apache#755) 6. move superset-ui/style to core (apache#756) 7. move superset-ui/validator to core (apache#757) 8. move superset-ui/chart-composition to core (apache#759) 9. move superset-ui/chart to core (apache#760)
1. move translation, connection, query to core (apache#729) 2. update encodable to remove formatter inter-dependency (apache#744) 3. move number-format and time-format to core (apache#730) 4. move superset-ui/dimension to core (apache#732) 5. move superset-ui/color to core (apache#755) 6. move superset-ui/style to core (apache#756) 7. move superset-ui/validator to core (apache#757) 8. move superset-ui/chart-composition to core (apache#759) 9. move superset-ui/chart to core (apache#760)
1. move translation, connection, query to core (apache#729) 2. update encodable to remove formatter inter-dependency (apache#744) 3. move number-format and time-format to core (apache#730) 4. move superset-ui/dimension to core (apache#732) 5. move superset-ui/color to core (apache#755) 6. move superset-ui/style to core (apache#756) 7. move superset-ui/validator to core (apache#757) 8. move superset-ui/chart-composition to core (apache#759) 9. move superset-ui/chart to core (apache#760)
1. move translation, connection, query to core (apache#729) 2. update encodable to remove formatter inter-dependency (apache#744) 3. move number-format and time-format to core (apache#730) 4. move superset-ui/dimension to core (apache#732) 5. move superset-ui/color to core (apache#755) 6. move superset-ui/style to core (apache#756) 7. move superset-ui/validator to core (apache#757) 8. move superset-ui/chart-composition to core (apache#759) 9. move superset-ui/chart to core (apache#760)
Current change adds ability to execute the SQL queries on the celery worker.
More info about celery can be found here:
Worker can be started via command
caravel worker
Celery is configured in the config.py and by default it is turned off. (
CELERY_CONFIG = None
)Fixed some lint issues in the tests.
Tested:
CELERY_CONFIG = None
and withTask is passed and executed:
Query works for both cases:
Reviewers: