]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
sequential, parallel: allow entries to be references to top-level config
authorSage Weil <sage@inktank.com>
Mon, 22 Jul 2013 20:03:24 +0000 (13:03 -0700)
committerSage Weil <sage@inktank.com>
Tue, 23 Jul 2013 22:38:29 +0000 (15:38 -0700)
Often we want to build a test collection that substitutes different
sequences of tasks into a parallel/sequential construction.  However, the
yaml combination that happens when generating jobs is not smart enough to
substitute some fragment into a deeply-nested piece of yaml.

Instead, make these sequences top-level entries in the config dict, and
reference them.  For example:

tasks:
- install:
- ceph:
- parallel:
  - workload
  - upgrade-sequence
workload:
  workunit:
    - something
upgrade-sequence:
  install.restart: [osd.0, osd.1]

Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/task/parallel.py
teuthology/task/sequential.py

index d8fe1409bbbd3e1d8949d8d0c1805874812a05ca..6127e07c7832019d522ad123462d30ad4b6e9bce 100644 (file)
@@ -17,12 +17,26 @@ def task(ctx, config):
        - tasktest:
        - tasktest:
 
+    You can also reference the job from elsewhere:
+
+    foo:
+      tasktest:
+    tasks:
+    - parallel:
+      - foo
+      - tasktest:
+
+    That is, if the entry is not a dict, we will look it up in the top-level
+    config.
+
     Sequential task and Parallel tasks can be nested.
     """
     
     log.info('starting parallel...')
     with parallel.parallel() as p:
         for entry in config:
+            if not isinstance(entry, dict):
+                entry = ctx.config.get(entry, {})
             ((taskname, confg),) = entry.iteritems()
             p.spawn(_run_spawned, ctx, confg, taskname)
 
index ebcafcf8b83d708175566aeeb08633ef11688fd1..4f74359c6ffe7356a26d0d0b7f878f1fdd0032c9 100644 (file)
@@ -16,11 +16,26 @@ def task(ctx, config):
        - tasktest:
        - tasktest:
 
+    You can also reference the job from elsewhere:
+
+    foo:
+      tasktest:
+    tasks:
+    - sequential:
+      - tasktest:
+      - foo
+      - tasktest:
+
+    That is, if the entry is not a dict, we will look it up in the top-level
+    config.
+
     Sequential task and Parallel tasks can be nested.
     """
     stack = []
     try:
         for entry in config:
+            if not isinstance(entry, dict):
+                entry = ctx.config.get(entry, {})
             ((taskname, confg),) = entry.iteritems()
             log.info('In sequential, running task %s...' % taskname)
             mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg)