From 17b0e7af260c942093ac5d0c49e5f13ea7d9ed96 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" Date: Wed, 27 Jan 2021 18:28:09 +0100 Subject: [PATCH] cli: Make cli work with new lister while allowing legacy lister to still run (with --legacy) --- swh/lister/cli.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/swh/lister/cli.py b/swh/lister/cli.py index 7237d5f..650b4e0 100644 --- a/swh/lister/cli.py +++ b/swh/lister/cli.py @@ -129,9 +129,10 @@ def db_init(ctx, drop_tables): type=click.Choice(["high", "medium", "low"]), help="Task priority for the listed repositories to ingest", ) +@click.option("--legacy", help="Allow unported lister to run with such flag") @click.argument("options", nargs=-1) @click.pass_context -def run(ctx, lister, priority, options): +def run(ctx, lister, priority, options, legacy): from swh.scheduler.cli.utils import parse_options config = deepcopy(ctx.obj["config"]) @@ -139,8 +140,9 @@ def run(ctx, lister, priority, options): if options: config.update(parse_options(options)[1]) - config["priority"] = priority - config["policy"] = "oneshot" + if legacy: + config["priority"] = priority + config["policy"] = "oneshot" get_lister(lister, **config).run()