ceph/qa/tasks/watch_notify_stress.py
Thomas Bechtold bdcc94a1d1 qa: Run flake8 on python2 and python3
To be able to catch problems with python2 *and* python3, run flake8
with both versions. From the flake8 homepage:

It is very important to install Flake8 on the correct version of
Python for your needs. If you want Flake8 to properly parse new
language features in Python 3.5 (for example), you need it to be
installed on 3.5 for Flake8 to understand those features. In many
ways, Flake8 is tied to the version of Python on which it runs.

Also fix the problems with python3 on the way.
Note: This requires now the six module for teuthology. But this is
already an install_require in teuthology itself.

Signed-off-by: Thomas Bechtold <tbechtold@suse.com>
2019-12-13 09:24:20 +01:00

71 lines
1.6 KiB
Python

"""
test_stress_watch task
"""
import contextlib
import logging
import proc_thrasher
import six
from teuthology.orchestra import run
log = logging.getLogger(__name__)
@contextlib.contextmanager
def task(ctx, config):
"""
Run test_stress_watch
The config should be as follows:
test_stress_watch:
clients: [client list]
example:
tasks:
- ceph:
- test_stress_watch:
clients: [client.0]
- interactive:
"""
log.info('Beginning test_stress_watch...')
assert isinstance(config, dict), \
"please list clients to run on"
testwatch = {}
remotes = []
for role in config.get('clients', ['client.0']):
assert isinstance(role, six.string_types)
PREFIX = 'client.'
assert role.startswith(PREFIX)
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.keys()
remotes.append(remote)
args =['CEPH_CLIENT_ID={id_}'.format(id_=id_),
'CEPH_ARGS="{flags}"'.format(flags=config.get('flags', '')),
'daemon-helper',
'kill',
'multi_stress_watch foo foo'
]
log.info("args are %s" % (args,))
proc = proc_thrasher.ProcThrasher({}, remote,
args=[run.Raw(i) for i in args],
logger=log.getChild('testwatch.{id}'.format(id=id_)),
stdin=run.PIPE,
wait=False
)
proc.start()
testwatch[id_] = proc
try:
yield
finally:
log.info('joining watch_notify_stress')
for i in testwatch.itervalues():
i.join()