Skip to content
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

chore(celery): Cleanup config and async query specifications #25314

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Sep 15, 2023

SUMMARY

Whilst spelunking through the code looking at global async queries and Celery I realized that there was a number of inconsistencies with how the various CeleryConfig et al. objects were defined (referencing legacy settings or outdated tasks). This PR cleans up said logic.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@john-bodley john-bodley added the review:checkpoint Last PR reviewed during the daily review standup label Sep 15, 2023
'sql_lab.get_sql_results': {
'rate_limit': '100/s',
},
'email_reports.send': {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The email_reports.send task does not exist.

imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )
result_backend = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
broker_url = f"redis://{REDIS_HOST}:{REDIS_PORT}/0"
imports = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports should include importing the modules where the associated tasks are defined.

)
result_backend = 'redis://localhost:6379/0'
worker_log_level = 'DEBUG'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting does not exist.

'sql_lab.get_sql_results': {
'rate_limit': '100/s',
},
'email_reports.send': {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Task not not exist.

},
}
beat_schedule = {
'email_reports.schedule_hourly': {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Task does not exist.

imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )
imports = (
"superset.sql_lab",
"superset.tasks.cache",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module where the caching logic is defined.

broker_url = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No value in importing superset.tasks as the __init__.py is empty.

@@ -1498,13 +1490,7 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument

# Global async query config options.
# Requires GLOBAL_ASYNC_QUERIES feature flag to be enabled.
GLOBAL_ASYNC_QUERIES_REDIS_CONFIG = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were the same as the defaults and thus unncessary.

CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_RESULTS_DB}"
CELERY_ANNOTATIONS = {"sql_lab.add": {"rate_limit": "10/s"}}
CONCURRENCY = 1
broker_url = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These config settings were renamed and will be removed in Celery 6.0.

CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks.thumbnails")
CELERY_ANNOTATIONS = {"sql_lab.add": {"rate_limit": "10/s"}}
CONCURRENCY = 1
broker_url = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These config settings were renamed and will be removed in Celery 6.0.

@john-bodley john-bodley force-pushed the john-bodley--cleanup-celery-async-configs-and-documentation branch from 00ece63 to 9107e1e Compare September 15, 2023 18:55
@john-bodley john-bodley marked this pull request as ready for review September 15, 2023 19:54
@john-bodley john-bodley changed the title chore(celery): Cleanup config and async query chore(celery): Cleanup config and async query specifications Sep 16, 2023
@michael-s-molina michael-s-molina removed the review:checkpoint Last PR reviewed during the daily review standup label Sep 18, 2023
Copy link
Member

@craig-rueda craig-rueda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small comment, thank for doing this!

imports = (
'superset.sql_lab',
'superset.tasks',
"superset.sql_lab',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"superset.sql_lab', -> "superset.sql_lab",

@john-bodley john-bodley merged commit 1e37f0b into apache:master Oct 31, 2023
31 checks passed
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants