ceph/teuthology/task/sequential.py
Warren Usui e3d9084cd9 Created tasktest to test sequential and parallel tasks.
Added sequential task and parallel task.
Changed _run_one_task to run_one_task (now called by new tasks too).

Fix #4969
Signed-off-by: Warren Usui <warren.usui@inktank.com>
2013-07-15 19:08:23 -07:00

38 lines
936 B
Python

import sys
import logging
import contextlib
from teuthology import run_tasks
from ..orchestra import run
log = logging.getLogger(__name__)
def task(ctx, config):
"""
Sequentialize a group of tasks into one executable block
example:
- sequential:
- tasktest:
- tasktest:
Sequential task and Parallel tasks can be nested.
"""
stack = []
try:
for entry in config:
((taskname, confg),) = entry.iteritems()
log.info('In sequential, running task %s...' % taskname)
mgr = run_tasks.run_one_task(taskname, ctx=ctx, config=confg)
if hasattr(mgr, '__enter__'):
mgr.__enter__()
stack.append(mgr)
finally:
try:
exc_info = sys.exc_info()
while stack:
mgr = stack.pop()
endr = mgr.__exit__(*exc_info)
finally:
del exc_info