-
Notifications
You must be signed in to change notification settings - Fork 34
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
ext: add celery signals ep #91
base: master
Are you sure you want to change the base?
Conversation
jrcastro2
commented
Mar 26, 2025
- closes Job report invenio-jobs#67
623c886
to
0d43f63
Compare
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.
Pull Request Overview
This PR adds support for registering Celery signals via entry points, addressing the referenced issue.
- Introduces a new method load_celery_signals, which imports modules for signal registration
- Modifies init_app to set the logger level to DEBUG and load the signals
@@ -34,10 +34,18 @@ def __init__(self, app=None, **kwargs): | |||
def init_app(self, app, entry_point_group="invenio_celery.tasks", **kwargs): | |||
"""Initialize application object.""" | |||
self.init_config(app) | |||
app.logger.setLevel("DEBUG") |
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.
[nitpick] Setting the logger level to DEBUG directly here might override the application's logging configuration unexpectedly. Consider conditionally setting the logging level for development or making this configurable.
app.logger.setLevel("DEBUG") | |
log_level = app.config.get("LOG_LEVEL", "WARNING") | |
app.logger.setLevel(log_level) |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
def load_celery_signals(self): | ||
"""Load Celery signals.""" | ||
# Import Celery signals via entry points | ||
for ep in pkg_resources.iter_entry_points("invenio_celery.signals"): |
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 addded this to have a common place where the signals are registered, it could also be done in each repo if we prefer - instead of using an entry point