From: Andrew Schoen Date: Thu, 11 Dec 2014 19:40:51 +0000 (-0600) Subject: put a job into a 'waiting' status while it's locking machines X-Git-Tag: 1.1.0~1067^2~9^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6114acca2f52e6174eaa315339a9d211e95640de;p=teuthology.git put a job into a 'waiting' status while it's locking machines Signed-off-by: Andrew Schoen --- diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 0075d976c4..4e5bebe69a 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -19,6 +19,7 @@ from teuthology.job_status import get_status, set_status from teuthology.config import config as teuth_config from teuthology.parallel import parallel from ..orchestra import cluster, remote, run +from .. import report log = logging.getLogger(__name__) @@ -74,6 +75,9 @@ def lock_machines(ctx, config): # We want to make sure there are always this many machines available to_reserve = 5 + # change the status during the locking process + report.try_push_job_info(config, dict(status='waiting')) + while True: # get a candidate list of machines machines = lock.list_locks(machine_type=machine_type, up=True, @@ -138,8 +142,13 @@ def lock_machines(ctx, config): ctx.config['targets'] = newscandict else: ctx.config['targets'] = newly_locked - # FIXME: Ugh. - log.info('\n '.join(['Locked targets:', ] + yaml.safe_dump(ctx.config['targets'], default_flow_style=False).splitlines())) + locked_targets = yaml.safe_dump( + ctx.config['targets'], + default_flow_style=False + ).splitlines() + log.info('\n '.join(['Locked targets:', ] + locked_targets)) + # successfully locked machines, change status back to running + report.try_push_job_info(config, dict(status='running')) break elif not ctx.block: assert 0, 'not enough machines are available'