Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/npm/tasks.py
Show All 35 Lines | def get_last_update_seq(lister): | ||||
if not row: | if not row: | ||||
raise ValueError('No npm registry listing previously performed ! ' | raise ValueError('No npm registry listing previously performed ! ' | ||||
'This is required prior to the execution of an ' | 'This is required prior to the execution of an ' | ||||
'incremental listing.') | 'incremental listing.') | ||||
return row[0] | return row[0] | ||||
@app.task(name=__name__ + '.NpmListerTask') | @app.task(name=__name__ + '.NpmListerTask') | ||||
def npm_lister(**lister_args): | def list_npm_full(**lister_args): | ||||
'Full lister for the npm (javascript) registry' | |||||
lister = NpmLister(**lister_args) | lister = NpmLister(**lister_args) | ||||
with save_registry_state(lister): | with save_registry_state(lister): | ||||
lister.run() | lister.run() | ||||
@app.task(name=__name__ + '.NpmIncrementalListerTask') | @app.task(name=__name__ + '.NpmIncrementalListerTask') | ||||
def npm_incremental_lister(**lister_args): | def list_npm_incremental(**lister_args): | ||||
'Incremental lister for the npm (javascript) registry' | |||||
lister = NpmIncrementalLister(**lister_args) | lister = NpmIncrementalLister(**lister_args) | ||||
update_seq_start = get_last_update_seq(lister) | update_seq_start = get_last_update_seq(lister) | ||||
with save_registry_state(lister): | with save_registry_state(lister): | ||||
lister.run(min_bound=update_seq_start) | lister.run(min_bound=update_seq_start) | ||||
@app.task(name=__name__ + '.ping') | @app.task(name=__name__ + '.ping') | ||||
def ping(): | def _ping(): | ||||
return 'OK' | return 'OK' |