Skip to content

Commit

Permalink
Revert "Move output in task/s3readwrite"
Browse files Browse the repository at this point in the history
This reverts commit 26a33c3.

This is tryign to create the archive dir on the remote host:

2014-12-29T12:15:30.213 INFO:teuthology.orchestra.run.plana31:Running: 'mkdir -p /var/lib/teuthworker/archive/sage-2014-12-29_11:40:52-rgw-next---basic-multi/683052'
2014-12-29T12:15:30.231 ERROR:teuthology.contextutil:Saw exception from nested tasks
Traceback (most recent call last):
  File "/home/teuthworker/src/teuthology_master/teuthology/contextutil.py", line 28, in nested
    vars.append(enter())
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/var/lib/teuthworker/src/ceph-qa-suite_next/tasks/s3readwrite.py", line 241, in run_tests
    ctx.cluster.only(client).run(args=['mkdir', '-p', archive_dir])
  File "/home/teuthworker/src/teuthology_master/teuthology/orchestra/cluster.py", line 64, in run
    return [remote.run(**kwargs) for remote in remotes]
  File "/home/teuthworker/src/teuthology_master/teuthology/orchestra/remote.py", line 128, in run
    r = self._runner(client=self.ssh, name=self.shortname, **kwargs)
  File "/home/teuthworker/src/teuthology_master/teuthology/orchestra/run.py", line 368, in run
    r.wait()
  File "/home/teuthworker/src/teuthology_master/teuthology/orchestra/run.py", line 106, in wait
    exitstatus=status, node=self.hostname)
CommandFailedError: Command failed on plana31 with status 1: 'mkdir -p /var/lib/teuthworker/archive/sage-2014-12-29_11:40:52-rgw-next---basic-multi/683052'

...but it should only be on the local host.
  • Loading branch information
liewegas committed Dec 29, 2014
1 parent 0220cbb commit 3960530
Showing 1 changed file with 8 additions and 34 deletions.
42 changes: 8 additions & 34 deletions tasks/s3readwrite.py
Expand Up @@ -9,7 +9,6 @@
import random
import string
import yaml
from datetime import datetime

from teuthology import misc as teuthology
from teuthology import contextutil
Expand Down Expand Up @@ -89,11 +88,6 @@ def create_users(ctx, config):
testdir = teuthology.get_testdir(ctx)
users = {'s3': 'foo'}
cached_client_user_names = dict()
try:
archive_dir = ctx.archive
except AttributeError:
archive_dir = '/tmp'
arch_file = os.sep.join([archive_dir, 's3readwrite-{site}-{time}'])
for client in config['clients']:
cached_client_user_names[client] = dict()
s3tests_conf = config['s3tests_conf'][client]
Expand All @@ -103,11 +97,6 @@ def create_users(ctx, config):
s3tests_conf['readwrite'].setdefault('writers', 3)
s3tests_conf['readwrite'].setdefault('duration', 300)
s3tests_conf['readwrite'].setdefault('files', {})
timestamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
s3tests_conf['readwrite'].setdefault('output',
arch_file.format(site=client, time=timestamp))
s3tests_conf['readwrite'].setdefault('archive_dir', archive_dir)
s3tests_conf['readwrite'].setdefault('verbose', False)
rwconf = s3tests_conf['readwrite']
rwconf['files'].setdefault('num', 10)
rwconf['files'].setdefault('size', 2000)
Expand Down Expand Up @@ -226,28 +215,20 @@ def run_tests(ctx, config):
"""
assert isinstance(config, dict)
testdir = teuthology.get_testdir(ctx)
rem_file_list = []
for client, client_config in config['clients'].iteritems():
for client, client_config in config.iteritems():
(remote,) = ctx.cluster.only(client).remotes.keys()
conf = teuthology.get_file(remote, '{tdir}/archive/s3readwrite.{client}.config.yaml'.format(tdir=testdir, client=client))
args = [
'{tdir}/s3-tests/virtualenv/bin/s3tests-test-readwrite'.format(tdir=testdir),
]
if client_config is not None and 'extra_args' in client_config:
args.extend(client_config['extra_args'])
output_file = client_config['readwrite']['output']
archive_dir = client_config['readwrite']['archive_dir']
log.info('Output generated by s3readwrite test has been saved in %s' % output_file)
ctx.cluster.only(client).run(args=['mkdir', '-p', archive_dir])
args.extend([run.Raw('>'), output_file])
rem_file_list.append((remote, client, output_file, archive_dir))
ctx.cluster.only(client).run(args=args, stdin=StringIO(conf))
try:
yield
finally:
for remote_info in rem_file_list:
teuthology.pull_directory(remote_info[0], remote_info[3], remote_info[3])
ctx.cluster.only(remote_info[1]).run(args=['rm', '-f', remote_info[2]])

ctx.cluster.only(client).run(
args=args,
stdin=conf,
)
yield


@contextlib.contextmanager
Expand Down Expand Up @@ -290,8 +271,6 @@ def task(ctx, config):
readers: 10
writers: 3
duration: 600
output: /tmp/output
verbose: True
files:
num: 10
size: 2000
Expand All @@ -313,8 +292,6 @@ def task(ctx, config):
access_key: myaccesskey
secret_key: mysecretkey
This test writes results to the file specified in the output line under s3readwrite.
If no output is specified, the results are saved in a temporary file.
"""
assert config is None or isinstance(config, list) \
or isinstance(config, dict), \
Expand Down Expand Up @@ -363,10 +340,7 @@ def task(ctx, config):
clients=config,
s3tests_conf=s3tests_conf,
)),
lambda: run_tests(ctx=ctx, config=dict(
clients=config,
s3tests_conf=s3tests_conf,
)),
lambda: run_tests(ctx=ctx, config=config),
):
pass
yield

0 comments on commit 3960530

Please sign in to comment.