Skip to content

Commit

Permalink
document: fix invenio_celery.tasks endpoints.
Browse files Browse the repository at this point in the history
* Adds `invenio_celery.tasks` endpoint for documents.

Co-Authored-by: Peter Weber <[email protected]>
  • Loading branch information
rerowep authored and jma committed Feb 14, 2022
1 parent 7f82600 commit 76c7bda
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
4 changes: 2 additions & 2 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ def _(x):
'enabled': False
},
'replace-idby-contribution': {
'task': ('rero_ils.modules.documents.tasks.replace-idby-contribution'),
'task': ('rero_ils.modules.documents.tasks.replace_idby_contribution'),
'schedule': crontab(minute=22, hour=22, day_of_week=6),
# Every week on Saturday at 22:22 UTC,
'enabled': False
},
'replace_idby-subjects': {
'task': ('rero_ils.modules.documents.tasks.replace_idby-subjects'),
'task': ('rero_ils.modules.documents.tasks.replace_idby_subjects'),
'schedule': crontab(minute=22, hour=22, day_of_week=6),
# Every week on Saturday at 22:22 UTC,
'enabled': False
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,20 +311,20 @@ def run(self):
],
'invenio_search.templates': [
'rero_ils = rero_ils.es_templates:list_es_templates',
'operation_logs = rero_ils.modules.operation_logs'
'.es_templates:list_es_templates',
'operation_logs = rero_ils.modules.operation_logs.es_templates:list_es_templates',
],
'invenio_celery.tasks': [
'apiharvester = rero_ils.modules.apiharvester.tasks',
'collections = rero_ils.modules.collections.tasks',
'documents = rero_ils.modules.documents.tasks',
'ebooks = rero_ils.modules.ebooks.tasks',
'holdings = rero_ils.modules.holdings.tasks',
'items = rero_ils.modules.items.tasks',
'loans = rero_ils.modules.loans.tasks',
'modules = rero_ils.modules.tasks',
'notifications = rero_ils.modules.notifications.tasks',
'patrons = rero_ils.modules.patrons.tasks',
'rero_ils_collections = rero_ils.modules.collections.tasks',
'claims = rero_ils.modules.items.tasks',
'loans = rero_ils.modules.loans.tasks',
'stats = rero_ils.modules.stats.tasks',
'holdings = rero_ils.modules.holdings.tasks',
],
'invenio_records.jsonresolver': [
'acq_accounts = rero_ils.modules.acq_accounts.jsonresolver',
Expand Down
39 changes: 39 additions & 0 deletions tests/ui/test_invenio_celery_tasks_endpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Test for missing invenio_celery task endpoints."""

from __future__ import absolute_import, print_function

from importlib_metadata import entry_points
from invenio_records_rest.utils import obj_or_import_string


def test_missing_invenio_celery_task_endpoints(app):
"""Test missing invenio_celery task endpoints."""
celery_extension = app.extensions['invenio-celery']
celery_entpoints = []
for e in entry_points(group=celery_extension.entry_point_group):
celery_entpoints.append(e.value)

for task, data in app.config['CELERY_BEAT_SCHEDULE'].items():
task_function = data['task']
# test if function exist
assert obj_or_import_string(task_function)
endpoint = '.'.join(task_function.split('.')[:-1])
# test if endpoint is defined in setup.py in invenio_celery.tasks
assert endpoint in celery_entpoints

0 comments on commit 76c7bda

Please sign in to comment.