Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
Signed-off-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
  • Loading branch information
sidharthanup committed Jun 12, 2019
1 parent 7ee79bb commit f2b8827
Show file tree
Hide file tree
Showing 6 changed files with 538 additions and 19 deletions.
4 changes: 2 additions & 2 deletions qa/tasks/rsync.py
Expand Up @@ -162,7 +162,7 @@ def do_rsync(self):

if self.snap_enable:
# Enable snapshots
self.fs.mon_manager.raw_cluster_cmd("mds", "set", "allow_new_snaps", "true", "--yes-i-really-mean-it")
self.fs.mon_manager.raw_cluster_cmd("mds", "set", "allow_new_snaps", "true")

if not self.work_unit:
# Create a data directory, sub directory and rsync directory
Expand All @@ -175,7 +175,7 @@ def do_rsync(self):
time.sleep(5) # if source dorectory not exists wait for 5s and poll
iteration += 1
if iteration > 5:
assert self.check_if_dir_exists(self.source_dir), 'assert, source Directory doesnot exists'
assert self.check_if_dir_exists(self.source_dir), 'assert, source Directory does not exists'

# Start observing the event started by workunit task.
if self.work_unit:
Expand Down
41 changes: 24 additions & 17 deletions qa/tasks/workunit.py
Expand Up @@ -8,6 +8,7 @@

from util import get_remote_for_role
from util.workunit import get_refspec_after_overrides
from gevent.event import Event

from teuthology import misc
from teuthology.config import config as teuth_config
Expand Down Expand Up @@ -88,7 +89,7 @@ def start_observing(self):
"""
assert not self.observed
self.workunit_started.wait()
finished = self.workunit_finished.is_set():
finished = self.workunit_finished.is_set()
if not finished:
self.observed = True
self.workunit_finished.is_set()
Expand Down Expand Up @@ -210,31 +211,33 @@ def task(ctx, config):
created_mnt_dir = _make_scratch_dir(ctx, role, config.get('subdir'))
created_mountpoint[role] = created_mnt_dir

# Execute any non-all workunits
log.info("timeout={}".format(timeout))
log.info("cleanup={}".format(cleanup))
with parallel() as p:
for role, tests in clients.iteritems():
if role != "all":
ctx.workunit_state = WorkunitState()

if 'all' in clients:
# Execute any 'all' workunits
all_tasks = clients["all"]
_spawn_on_all_clients(ctx, refspec, all_tasks, config.get('env'),
config.get('basedir', 'qa/workunits'),
config.get('subdir'), timeout=timeout,
cleanup=cleanup)
else:
# Execute any non-all workunits
ctx.workunit_state.started()
log.info("timeout={}".format(timeout))
log.info("cleanup={}".format(cleanup))
with parallel() as p:
for role, tests in clients.iteritems():
p.spawn(_run_tests, ctx, refspec, role, tests,
config.get('env'),
basedir=config.get('basedir','qa/workunits'),
timeout=timeout,cleanup=cleanup)

ctx.workunit_state.finished()

if cleanup:
# Clean up dirs from any non-all workunits
for role, created in created_mountpoint.items():
_delete_dir(ctx, role, created)

# Execute any 'all' workunits
if 'all' in clients:
all_tasks = clients["all"]
_spawn_on_all_clients(ctx, refspec, all_tasks, config.get('env'),
config.get('basedir', 'qa/workunits'),
config.get('subdir'), timeout=timeout,
cleanup=cleanup)


def _client_mountpoint(ctx, cluster, id_):
"""
Returns the path to the expected mountpoint for workunits running
Expand Down Expand Up @@ -376,6 +379,8 @@ def _spawn_on_all_clients(ctx, refspec, tests, env, basedir, subdir, timeout=Non
client_remotes[role] = remote
created_mountpoint[role] = _make_scratch_dir(ctx, role, subdir)

ctx.workunit_state.started()

for unit in tests:
with parallel() as p:
for role, remote in client_remotes.items():
Expand All @@ -384,6 +389,8 @@ def _spawn_on_all_clients(ctx, refspec, tests, env, basedir, subdir, timeout=Non
subdir,
timeout=timeout)

ctx.workunit_state.finished()

# cleanup the generated client directories
if cleanup:
for role, _ in client_remotes.items():
Expand Down

0 comments on commit f2b8827

Please sign in to comment.