]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/parallel: accept lists of tasks in referenced sections 831/head
authorJosh Durgin <jdurgin@redhat.com>
Tue, 29 Mar 2016 22:19:38 +0000 (15:19 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Tue, 29 Mar 2016 22:29:24 +0000 (15:29 -0700)
This syntax is consistent with task configuration everywhere else.

The subtley of different syntax for this task made modifying suites
error-prone. Keep the existing syntax so we don't have to change all
the upgrade suites in each ceph-qa-suite branch.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
teuthology/task/parallel.py

index 4cfb67879e90fc4942b1010009084159ebe9b813..c5ea85a55aab8b5593111edebb42b1e7e5c2f176 100644 (file)
@@ -19,14 +19,23 @@ def task(ctx, config):
        - tasktest:
        - tasktest:
 
-    You can also reference the job from elsewhere:
+    You can also define tasks in a top-level section outside of
+    'tasks:', and reference them here.
+
+    The referenced section must contain a list of tasks to run
+    sequentially, or a single task as a dict. The latter is only
+    available for backwards compatibility with existing suites:
 
-    foo:
-      tasktest:
     tasks:
     - parallel:
-      - foo
-      - tasktest:
+      - tasktest: # task inline
+      - foo       # reference to top-level 'foo' section
+      - bar       # reference to top-level 'bar' section
+    foo:
+    - tasktest1:
+    - tasktest2:
+    bar:
+      tasktest: # note the list syntax from 'foo' is preferred
 
     That is, if the entry is not a dict, we will look it up in the top-level
     config.
@@ -39,10 +48,14 @@ def task(ctx, config):
         for entry in config:
             if not isinstance(entry, dict):
                 entry = ctx.config.get(entry, {})
+                # support the usual list syntax for tasks
+                if isinstance(entry, list):
+                    entry = dict(sequential=entry)
             ((taskname, confg),) = entry.iteritems()
             p.spawn(_run_spawned, ctx, confg, taskname)
 
-def _run_spawned(ctx,config,taskname):
+
+def _run_spawned(ctx, config, taskname):
     """Run one of the tasks (this runs in parallel with others)"""
     mgr = {}
     try: