]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Output a summary file when archiving a run.
authorJosh Durgin <josh.durgin@dreamhost.com>
Wed, 15 Jun 2011 22:52:30 +0000 (15:52 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Wed, 15 Jun 2011 22:52:36 +0000 (15:52 -0700)
For now, just record whether the test succeeded.

teuthology/run.py
teuthology/run_tasks.py

index e3072fa5f155a6e0ece405e8b92d725869823073..c3b3926d3efe94abd215a4532e1c3eedf7fcef29 100644 (file)
@@ -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)
index d9b01059b2df41d1ff2ebea1ff56d7fcd0736b34..d57074881e0d1b59e933ea73caa48897a65682b0 100644 (file)
@@ -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