Skip to content

Commit

Permalink
scripts: add wait script for watching run
Browse files Browse the repository at this point in the history
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 <kyrylo.shatskyy@suse.com>
  • Loading branch information
Kyr Shatskyy committed Dec 11, 2020
1 parent 1c641e9 commit 20ce419
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions scripts/wait.py
Original file line number Diff line number Diff line change
@@ -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 <name>
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 <name> 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)

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
'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',
],
},

Expand Down

0 comments on commit 20ce419

Please sign in to comment.