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

[celery] Using preferred configuration proceedure #5726

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Aug 25, 2018

We've been using the celery_statsd for additional Celery monitoring but have recently noticed issues with the config parsing, i.e.,

>>> from celery import Celery 
>>> 
>>> 
>>> class Config:
...     STATSD_HOST = 'localhost'
... 
>>> app = Celery(source_config=Config)
>>> app.conf.STATSD_HOST
Traceback (most recent call last):
  File ".../celery/utils/collections.py", line 130, in __getattr__
    return self[k]
  File ".../celery/utils/collections.py", line 436, in __getitem__
    return self.__missing__(key)
  File ".../celery/utils/collections.py", line 269, in __missing__
    raise KeyError(key)
KeyError: 'STATSD_HOST'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../celery/utils/collections.py", line 134, in __getattr__
    type(self).__name__, k))
AttributeError: 'Settings' object has no attribute 'STATSD_HOST'

According to the documentation it seems like the config_from_object is the suggested approach, which provides the correct behavior,

>>> app = Celery()
>>> app.config_from_object(Config)
>>> app.conf.STATSD_HOST
'localhost'
>>> 

to: @graceguo-supercat @kristw @michellethomas @mistercrunch @timifasubaa

@codecov-io
Copy link

Codecov Report

Merging #5726 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5726      +/-   ##
==========================================
+ Coverage   63.38%   63.38%   +<.01%     
==========================================
  Files         361      361              
  Lines       22995    22996       +1     
  Branches     2559     2559              
==========================================
+ Hits        14575    14576       +1     
  Misses       8405     8405              
  Partials       15       15
Impacted Files Coverage Δ
superset/utils.py 89.15% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54ae215...456b514. Read the comment docs.

@john-bodley john-bodley merged commit 52b99df into apache:master Aug 27, 2018
john-bodley added a commit to john-bodley/superset that referenced this pull request Aug 27, 2018
@john-bodley john-bodley deleted the john-bodley-celery-config-from-object branch August 27, 2018 03:20
john-bodley added a commit to airbnb/superset-fork that referenced this pull request Aug 27, 2018
[celery] Using preferred configuration proceedure (apache#5726)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 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 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants