From: Josh Durgin Date: Wed, 15 Jun 2011 22:52:30 +0000 (-0700) Subject: Output a summary file when archiving a run. X-Git-Tag: v0.94.10~27^2^2~364^2~1730 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9d6034470020600e184be108665c546eda09c8ed;p=ceph.git Output a summary file when archiving a run. For now, just record whether the test succeeded. --- diff --git a/teuthology/run.py b/teuthology/run.py index e3072fa5f155a..c3b3926d3efe9 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -90,5 +90,11 @@ def main(): for rem, roles in zip(remotes, ctx.config['roles']): ctx.cluster.add(rem, roles) - from teuthology.run_tasks import run_tasks - run_tasks(tasks=ctx.config['tasks'], ctx=ctx) + try: + summary = {} + from teuthology.run_tasks import run_tasks + run_tasks(tasks=ctx.config['tasks'], ctx=ctx, summary=summary) + finally: + if ctx.archive is not None: + with file(os.path.join(ctx.archive, 'summary.yaml'), 'w') as f: + yaml.safe_dump(summary, f, default_flow_style=False) diff --git a/teuthology/run_tasks.py b/teuthology/run_tasks.py index d9b01059b2df4..d57074881e0d1 100644 --- a/teuthology/run_tasks.py +++ b/teuthology/run_tasks.py @@ -9,7 +9,7 @@ def _run_one_task(taskname, **kwargs): fn = getattr(mod, 'task') return fn(**kwargs) -def run_tasks(tasks, ctx): +def run_tasks(tasks, ctx, summary): stack = [] try: for taskdict in tasks: @@ -23,6 +23,7 @@ def run_tasks(tasks, ctx): manager.__enter__() stack.append(manager) except: + summary['success'] = False log.exception('Saw exception from tasks') finally: try: @@ -33,6 +34,7 @@ def run_tasks(tasks, ctx): try: suppress = manager.__exit__(*exc_info) except: + summary['success'] = False log.exception('Manager failed: %s', manager) else: if suppress: @@ -45,3 +47,5 @@ def run_tasks(tasks, ctx): finally: # be careful about cyclic references del exc_info + if 'success' not in summary: + summary['success'] = True