]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
task: add full_sequential
authorSamuel Just <sjust@redhat.com>
Mon, 4 May 2015 16:38:18 +0000 (09:38 -0700)
committerSamuel Just <sjust@redhat.com>
Mon, 4 May 2015 16:38:18 +0000 (09:38 -0700)
teuthology/task/full_sequential.py [new file with mode: 0644]

diff --git a/teuthology/task/full_sequential.py b/teuthology/task/full_sequential.py
new file mode 100644 (file)
index 0000000..197a554
--- /dev/null
@@ -0,0 +1,39 @@
+"""
+Task sequencer - full
+"""
+import sys
+import logging
+
+from teuthology import run_tasks
+
+log = logging.getLogger(__name__)
+
+
+def task(ctx, config):
+    """
+    Run a set of tasks to completion in order.  __exit__ is called on a task
+    before __enter__ on the next
+
+    example:
+    - full_sequential:
+       - tasktest:
+       - tasktest:
+
+    :param ctx: Context
+    :param config: Configuration
+    """
+    for entry in config:
+        if not isinstance(entry, dict):
+            entry = ctx.config.get(entry, {})
+        ((taskname, confg),) = entry.iteritems()
+        log.info('In full_sequential, running task %s...' % taskname)
+        mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg)
+        if hasattr(mgr, '__enter__'):
+            try:
+                mgr.__enter__()
+            finally:
+                try:
+                    exc_info = sys.exc_info()
+                    mgr.__exit__(*exc_info)
+                finally:
+                    del exc_info