You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "john-bodley (via GitHub)" <gi...@apache.org> on 2023/09/15 18:51:56 UTC

[GitHub] [superset] john-bodley commented on a diff in pull request #25314: chore(celery): Cleanup config and async query

john-bodley commented on code in PR #25314:
URL: https://github.com/apache/superset/pull/25314#discussion_r1327551210


##########
docs/docs/installation/alerts-reports.mdx:
##########
@@ -104,30 +104,27 @@ REDIS_HOST = "superset_cache"
 REDIS_PORT = "6379"
 
 class CeleryConfig:
-    broker_url = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
-    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 = (
+        "superset.sql_lab",
+        "superset.tasks.scheduler",
+    )
+    result_backend = f"redis://{REDIS_HOST}:{REDIS_PORT}/0"
     worker_prefetch_multiplier = 10
     task_acks_late = True
     task_annotations = {
-        'sql_lab.get_sql_results': {
-            'rate_limit': '100/s',
-        },
-        'email_reports.send': {

Review Comment:
   The `email_reports.send` task does not exist.



##########
docs/docs/installation/async-queries-celery.mdx:
##########
@@ -23,30 +23,17 @@ and web server processes should have the same configuration.
 
 ```python
 class CeleryConfig(object):
-    broker_url = 'redis://localhost:6379/0'
+    broker_url = "redis://localhost:6379/0"
     imports = (
-        'superset.sql_lab',
-        'superset.tasks',
+        "superset.sql_lab',
+        "superset.tasks.scheduler",
     )
-    result_backend = 'redis://localhost:6379/0'
-    worker_log_level = 'DEBUG'
+    result_backend = "redis://localhost:6379/0"
     worker_prefetch_multiplier = 10
     task_acks_late = True
     task_annotations = {
-        'sql_lab.get_sql_results': {
-            'rate_limit': '100/s',
-        },
-        'email_reports.send': {

Review Comment:
   Task not not exist.



##########
docs/docs/installation/alerts-reports.mdx:
##########
@@ -104,30 +104,27 @@ REDIS_HOST = "superset_cache"
 REDIS_PORT = "6379"
 
 class CeleryConfig:
-    broker_url = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
-    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 = (

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



##########
tests/integration_tests/superset_test_config.py:
##########
@@ -133,11 +133,10 @@ def GET_FEATURE_FLAGS_FUNC(ff):
 
 
 class CeleryConfig:
-    BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
-    CELERY_IMPORTS = ("superset.sql_lab",)
-    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}"

Review Comment:
   These config settings were [renamed](https://docs.celeryq.dev/en/stable/userguide/configuration.html#new-lowercase-settings) and will  be removed in Celery 6.0.



##########
docs/docs/installation/async-queries-celery.mdx:
##########
@@ -23,30 +23,17 @@ and web server processes should have the same configuration.
 
 ```python
 class CeleryConfig(object):
-    broker_url = 'redis://localhost:6379/0'
+    broker_url = "redis://localhost:6379/0"
     imports = (
-        'superset.sql_lab',
-        'superset.tasks',
+        "superset.sql_lab',
+        "superset.tasks.scheduler",
     )
-    result_backend = 'redis://localhost:6379/0'
-    worker_log_level = 'DEBUG'
+    result_backend = "redis://localhost:6379/0"
     worker_prefetch_multiplier = 10
     task_acks_late = True
     task_annotations = {
-        'sql_lab.get_sql_results': {
-            'rate_limit': '100/s',
-        },
-        'email_reports.send': {
-            'rate_limit': '1/s',
-            'time_limit': 120,
-            'soft_time_limit': 150,
-            'ignore_result': True,
-        },
-    }
-    beat_schedule = {
-        'email_reports.schedule_hourly': {

Review Comment:
   Task does not exist.



##########
tests/integration_tests/superset_test_config_thumbnails.py:
##########
@@ -62,10 +62,9 @@ def GET_FEATURE_FLAGS_FUNC(ff):
 
 
 class CeleryConfig:
-    BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
-    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}"

Review Comment:
   These config settings were [renamed](https://docs.celeryq.dev/en/stable/userguide/configuration.html#new-lowercase-settings) and will be removed in Celery 6.0.



##########
docs/docs/installation/running-on-kubernetes.mdx:
##########
@@ -367,37 +367,35 @@ configOverrides:
   celery_conf: |
     from celery.schedules import crontab
 
-    class CeleryConfig(object):
+    class CeleryConfig:
       broker_url = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
-      imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )

Review Comment:
   No value in importing `superset.tasks` as the `__init__.py` is empty.



##########
docs/docs/installation/alerts-reports.mdx:
##########
@@ -104,30 +104,27 @@ REDIS_HOST = "superset_cache"
 REDIS_PORT = "6379"
 
 class CeleryConfig:
-    broker_url = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
-    imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )

Review Comment:
   No value in importing `superset.tasks` as the `__init__.py` is empty.



##########
docs/docs/installation/running-on-kubernetes.mdx:
##########
@@ -367,37 +367,35 @@ configOverrides:
   celery_conf: |
     from celery.schedules import crontab
 
-    class CeleryConfig(object):
+    class CeleryConfig:
       broker_url = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
-      imports = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )
+      imports = (
+          "superset.sql_lab",
+          "superset.tasks.cache",

Review Comment:
   Module where the caching logic  is defined.



##########
superset/config.py:
##########
@@ -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 = {

Review Comment:
   These were the same as the [defaults](https://github.com/redis/redis-py/blob/master/redis/client.py#L144-L187) and thus unncessary.



##########
docs/docs/installation/async-queries-celery.mdx:
##########
@@ -23,30 +23,17 @@ and web server processes should have the same configuration.
 
 ```python
 class CeleryConfig(object):
-    broker_url = 'redis://localhost:6379/0'
+    broker_url = "redis://localhost:6379/0"
     imports = (
-        'superset.sql_lab',
-        'superset.tasks',
+        "superset.sql_lab',
+        "superset.tasks.scheduler",
     )
-    result_backend = 'redis://localhost:6379/0'
-    worker_log_level = 'DEBUG'

Review Comment:
   Setting does not exist.



##########
docs/docs/installation/cache.mdx:
##########
@@ -114,7 +114,10 @@ from s3cache.s3cache import S3Cache
 
 class CeleryConfig(object):
     broker_url = "redis://localhost:6379/0"
-    imports = ("superset.sql_lab", "superset.tasks", "superset.tasks.thumbnails")

Review Comment:
   No value in importing `superset.tasks` as the `__init__.py` is empty.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org