Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/cli.py
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
) | ) | ||||
@click.option( | @click.option( | ||||
"--priority", | "--priority", | ||||
"-p", | "-p", | ||||
default="high", | default="high", | ||||
type=click.Choice(["high", "medium", "low"]), | type=click.Choice(["high", "medium", "low"]), | ||||
help="Task priority for the listed repositories to ingest", | 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.argument("options", nargs=-1) | ||||
@click.pass_context | @click.pass_context | ||||
def run(ctx, lister, priority, options): | def run(ctx, lister, priority, options, legacy): | ||||
from swh.scheduler.cli.utils import parse_options | from swh.scheduler.cli.utils import parse_options | ||||
config = deepcopy(ctx.obj["config"]) | config = deepcopy(ctx.obj["config"]) | ||||
if options: | if options: | ||||
config.update(parse_options(options)[1]) | config.update(parse_options(options)[1]) | ||||
if legacy: | |||||
config["priority"] = priority | config["priority"] = priority | ||||
config["policy"] = "oneshot" | config["policy"] = "oneshot" | ||||
get_lister(lister, **config).run() | get_lister(lister, **config).run() | ||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
lister() | lister() |