Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tasks.py
# Copyright (C) 2016-2019 The Software Heritage developers | # Copyright (C) 2016-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# 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 current_app as app | from celery import current_app as app | ||||
from .mimetype import MimetypeIndexer, MimetypeRangeIndexer | from .mimetype import MimetypeIndexer, MimetypeRangeIndexer | ||||
from .ctags import CtagsIndexer | from .ctags import CtagsIndexer | ||||
from .fossology_license import ( | from .fossology_license import ( | ||||
FossologyLicenseIndexer, FossologyLicenseRangeIndexer | FossologyLicenseIndexer, FossologyLicenseRangeIndexer | ||||
) | ) | ||||
from .rehash import RecomputeChecksums | from .rehash import RecomputeChecksums | ||||
from .metadata import OriginMetadataIndexer | from .metadata import OriginMetadataIndexer | ||||
@app.task(name=__name__ + '.OriginMetadata') | @app.task(name=__name__ + '.OriginMetadata') | ||||
def origin_metadata(*args, **kwargs): | def origin_metadata(*args, **kwargs): | ||||
results = OriginMetadataIndexer().run(*args, **kwargs) | return OriginMetadataIndexer().run(*args, **kwargs) | ||||
return getattr(results, 'results', results) | |||||
@app.task(name=__name__ + '.Ctags') | @app.task(name=__name__ + '.Ctags') | ||||
def ctags(*args, **kwargs): | def ctags(*args, **kwargs): | ||||
results = CtagsIndexer().run(*args, **kwargs) | return CtagsIndexer().run(*args, **kwargs) | ||||
return getattr(results, 'results', results) | |||||
@app.task(name=__name__ + '.ContentFossologyLicense') | @app.task(name=__name__ + '.ContentFossologyLicense') | ||||
def fossology_license(*args, **kwargs): | def fossology_license(*args, **kwargs): | ||||
results = FossologyLicenseIndexer().run(*args, **kwargs) | return FossologyLicenseIndexer().run(*args, **kwargs) | ||||
return getattr(results, 'results', results) | |||||
@app.task(name=__name__ + '.RecomputeChecksums') | @app.task(name=__name__ + '.RecomputeChecksums') | ||||
def recompute_checksums(*args, **kwargs): | def recompute_checksums(*args, **kwargs): | ||||
results = RecomputeChecksums().run(*args, **kwargs) | return RecomputeChecksums().run(*args, **kwargs) | ||||
return getattr(results, 'results', results) | |||||
vlorentz: Does anything currently use these results? | |||||
Done Inline Actionsthe status is used by the scheduler. the specific tasks you are targetting by this comment no longer runs for now. ardumont: the status is used by the scheduler.
the other summaries will simply be displayed in logs.
so… | |||||
@app.task(name=__name__ + '.ContentMimetype') | @app.task(name=__name__ + '.ContentMimetype') | ||||
def mimetype(*args, **kwargs): | def mimetype(*args, **kwargs): | ||||
results = MimetypeIndexer().run(*args, **kwargs) | return MimetypeIndexer().run(*args, **kwargs) | ||||
return {'status': 'eventful' if results else 'uneventful'} | |||||
@app.task(name=__name__ + '.ContentRangeMimetype') | @app.task(name=__name__ + '.ContentRangeMimetype') | ||||
def range_mimetype(*args, **kwargs): | def range_mimetype(*args, **kwargs): | ||||
results = MimetypeRangeIndexer().run(*args, **kwargs) | return MimetypeRangeIndexer().run(*args, **kwargs) | ||||
return {'status': 'eventful' if results else 'uneventful'} | |||||
@app.task(name=__name__ + '.ContentRangeFossologyLicense') | @app.task(name=__name__ + '.ContentRangeFossologyLicense') | ||||
def range_license(*args, **kwargs): | def range_license(*args, **kwargs): | ||||
results = FossologyLicenseRangeIndexer().run(*args, **kwargs) | return FossologyLicenseRangeIndexer().run(*args, **kwargs) | ||||
return {'status': 'eventful' if results else 'uneventful'} |
Does anything currently use these results?