Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/pypi/tasks.py
| # Copyright (C) 2018 the Software Heritage developers | # Copyright (C) 2018-2021 the Software Heritage developers | ||||
| # License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
| # See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
| from celery import shared_task | from celery import shared_task | ||||
| from .lister import PyPILister | from .lister import PyPILister | ||||
| @shared_task(name=__name__ + ".PyPIListerTask") | @shared_task(name=f"{__name__}.PyPIListerTask") | ||||
| def list_pypi(): | def list_pypi(): | ||||
| "Full listing of the PyPI registry" | "Full listing of the PyPI registry" | ||||
| lister = PyPILister.from_configfile() | lister = PyPILister.from_configfile() | ||||
| return lister.run().dict() | return lister.run().dict() | ||||
| @shared_task(name=f"{__name__}.IncrementalPyPILister") | |||||
| def list_pypi_incremental(): | |||||
| "Incremental listing of the PyPI registry" | |||||
| lister = PyPILister.from_configfile(incremental=True) | |||||
| return lister.run().dict() | |||||
| @shared_task(name=__name__ + ".ping") | @shared_task(name=__name__ + ".ping") | ||||
| def _ping(): | def _ping(): | ||||
| return "OK" | return "OK" |