Skip to content
Snippets Groups Projects
Commit 7092e4e4 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

cli: Use temporary scheduler as fallback when no configuration detected

In order to simplify the testing of listers, allow to call the run command
of swh-lister CLI without scheduler configuration. In that case a temporary
scheduler instance with a postgresql backend is created and used.

It enables to easily test a lister with the following command:

$ swh -l DEBUG lister run <lister_name> url=<forge_url>
parent 7344d264
1 merge request!478cli: Use temporary scheduler as fallback when no configuration detected
swh.core[db,github] >= 2.22.0 swh.core[db,github] >= 2.22.0
swh.scheduler >= 0.8 swh.scheduler >= 1.12.0
...@@ -69,6 +69,14 @@ def run(ctx, lister, options): ...@@ -69,6 +69,14 @@ def run(ctx, lister, options):
if options: if options:
config.update(parse_options(options)[1]) config.update(parse_options(options)[1])
if "scheduler" not in config:
logger.warning(
"No scheduler configuration detected, using a temporary instance "
"with postgresql backend instead."
)
config["scheduler"] = {"cls": "temporary"}
get_lister(lister, **config).run() get_lister(lister, **config).run()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment