Skip to content

Commit 0d43f63

Browse files
committed
ext: add celery signals ep
* closes inveniosoftware/invenio-jobs#67
1 parent 869c18d commit 0d43f63

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

invenio_celery/ext.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,18 @@ def __init__(self, app=None, **kwargs):
3434
def init_app(self, app, entry_point_group="invenio_celery.tasks", **kwargs):
3535
"""Initialize application object."""
3636
self.init_config(app)
37+
app.logger.setLevel("DEBUG")
3738
self.celery = FlaskCeleryExt(app).celery
3839
self.entry_point_group = entry_point_group
40+
self.load_celery_signals()
3941
app.extensions["invenio-celery"] = self
4042

43+
def load_celery_signals(self):
44+
"""Load Celery signals."""
45+
# Import Celery signals via entry points
46+
for ep in pkg_resources.iter_entry_points("invenio_celery.signals"):
47+
__import__(ep.module_name) # Just import the module to trigger registration
48+
4149
def load_entry_points(self):
4250
"""Load tasks from entry points."""
4351
if self.entry_point_group:

0 commit comments

Comments
 (0)