From: Zack Cerza Date: Mon, 14 Oct 2013 21:35:51 +0000 (-0500) Subject: Make check for running jobs part of the loop X-Git-Tag: 1.1.0~1804^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F134%2Fhead;p=teuthology.git Make check for running jobs part of the loop Use a new, tested implementation to check for running jobs. Signed-off-by: Zack Cerza --- diff --git a/teuthology/results.py b/teuthology/results.py index 37decdcdf..e1fc17979 100644 --- a/teuthology/results.py +++ b/teuthology/results.py @@ -10,6 +10,7 @@ from textwrap import fill import teuthology from teuthology import misc from teuthology import suite +from .report import ResultsSerializer log = logging.getLogger(__name__) @@ -40,26 +41,17 @@ def main(args): def results(args): - running_tests = [ - f for f in sorted(os.listdir(args.archive_dir)) - if not f.startswith('.') - and os.path.isdir(os.path.join(args.archive_dir, f)) - and not os.path.exists(os.path.join( - args.archive_dir, f, 'summary.yaml')) - ] + archive_base = os.path.split(args.archive_dir, args.name) + serializer = ResultsSerializer(archive_base) starttime = time.time() + log.info('Waiting up to %d seconds for tests to finish...', args.timeout) - while running_tests and args.timeout > 0: - if os.path.exists(os.path.join( - args.archive_dir, - running_tests[-1], 'summary.yaml')): - running_tests.pop() - else: - if time.time() - starttime > args.timeout: - log.warn('test(s) did not finish before timeout of %d seconds', - args.timeout) - break - time.sleep(10) + while serializer.running_jobs_for_run(args.name) and args.timeout > 0: + if time.time() - starttime > args.timeout: + log.warn('test(s) did not finish before timeout of %d seconds', + args.timeout) + break + time.sleep(10) log.info('Tests finished! gathering results...') (subject, body) = build_email_body(args.name, args.archive_dir,