From 20ce4194502d1b62b2b012eac753e89d7158464b Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Fri, 11 Dec 2020 18:48:16 +0100 Subject: [PATCH] scripts: add wait script for watching run While using teuthology-suite with --wait option it is usefull sometimes to split the suite scheduling and the run waiting. For example, when using tools like Jenkins we might want to schedule a suite, report about successful schedule and start waiting only in the next steps. Signed-off-by: Kyr Shatskyy --- scripts/wait.py | 31 +++++++++++++++++++++++++++++++ setup.py | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 scripts/wait.py diff --git a/scripts/wait.py b/scripts/wait.py new file mode 100644 index 0000000000..6b2ff34a91 --- /dev/null +++ b/scripts/wait.py @@ -0,0 +1,31 @@ +import docopt +import sys + +import logging + +import teuthology +import teuthology.suite +from teuthology.config import config + +doc = """ +usage: teuthology-wait --help + teuthology-wait [-v] --run + +Wait until run is finished. Returns exit code 0 on success, otherwise 1. + +Miscellaneous arguments: + -h, --help Show this help message and exit + -v, --verbose Be more verbose + +Standard arguments: + -r, --run Run name to watch. +""" + + +def main(argv=sys.argv[1:]): + args = docopt.docopt(doc, argv=argv) + if args.get('--verbose'): + teuthology.log.setLevel(logging.DEBUG) + name = args.get('--run') + return teuthology.suite.wait(name, config.max_job_time, None) + diff --git a/setup.py b/setup.py index e595da4a64..cdbe81392e 100644 --- a/setup.py +++ b/setup.py @@ -129,7 +129,8 @@ setup( 'teuthology-queue = scripts.queue:main', 'teuthology-prune-logs = scripts.prune_logs:main', 'teuthology-describe = scripts.describe:main', - 'teuthology-reimage = scripts.reimage:main' + 'teuthology-reimage = scripts.reimage:main', + 'teuthology-wait = scripts.wait:main', ], }, -- 2.39.5