diff --git a/perun/proxy/utils/run_probes.py b/perun/proxy/utils/run_probes.py index c092074c84386e7ed6d3680c48eeef6c277a1df4..b94fdbfc3df619881fc6c6c86c161d668e99e279 100644 --- a/perun/proxy/utils/run_probes.py +++ b/perun/proxy/utils/run_probes.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 +import argparse import re import subprocess import sys @@ -73,9 +74,27 @@ def run_probe(probe_name, command, timeout): return result.returncode +def parse_arguments(): + parser = argparse.ArgumentParser() + parser.add_argument( + "-p", + "--probes", + nargs="+", + default=[], + help="Optional list of probes to run from the config." + "If not specified, all probes will be run.", + ) + args = parser.parse_args() + return args + + def main(): + args = parse_arguments() + probes_to_run = args.probes + config_filepath = "/etc/run_probes_cfg.yaml" config = yaml.safe_load(open_file(config_filepath)) + if not config: return @@ -83,6 +102,8 @@ def main(): for _, options in config["checks"].items(): module = options["module"] for name, args in options.get("runs").items(): + if probes_to_run and name not in probes_to_run: + continue command = ["python3", "-m", module] timeout = global_timeout if args is not None: