forked from TrueCloudLab/s3-tests
readwrite: error propagation code
This is my attempt at enabling errors in the readwrite.py to propate up to the calling teuthology task. Signed-off-by: Joe Buck <jbbuck@gmail.com>
This commit is contained in:
parent
34a06133eb
commit
9799858e90
1 changed files with 27 additions and 14 deletions
|
@ -55,13 +55,13 @@ def reader(bucket, worker_id, file_names, queue, rand):
|
||||||
msg='md5sum check failed',
|
msg='md5sum check failed',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
elapsed = end - start
|
elapsed = end - start
|
||||||
result.update(
|
result.update(
|
||||||
start=start,
|
start=start,
|
||||||
duration=int(round(elapsed * NANOSECOND)),
|
duration=int(round(elapsed * NANOSECOND)),
|
||||||
chunks=fp.chunks,
|
chunks=fp.chunks,
|
||||||
)
|
)
|
||||||
queue.put(result)
|
queue.put(result)
|
||||||
|
|
||||||
def writer(bucket, worker_id, file_names, files, queue, rand):
|
def writer(bucket, worker_id, file_names, files, queue, rand):
|
||||||
|
@ -97,12 +97,13 @@ def writer(bucket, worker_id, file_names, files, queue, rand):
|
||||||
else:
|
else:
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
elapsed = end - start
|
elapsed = end - start
|
||||||
result.update(
|
result.update(
|
||||||
start=start,
|
start=start,
|
||||||
duration=int(round(elapsed * NANOSECOND)),
|
duration=int(round(elapsed * NANOSECOND)),
|
||||||
chunks=fp.last_chunks,
|
chunks=fp.last_chunks,
|
||||||
)
|
)
|
||||||
|
|
||||||
queue.put(result)
|
queue.put(result)
|
||||||
|
|
||||||
def parse_options():
|
def parse_options():
|
||||||
|
@ -241,7 +242,19 @@ def main():
|
||||||
q.put(StopIteration)
|
q.put(StopIteration)
|
||||||
gevent.spawn_later(config.readwrite.duration, stop)
|
gevent.spawn_later(config.readwrite.duration, stop)
|
||||||
|
|
||||||
yaml.safe_dump_all(q, stream=real_stdout)
|
# wait for all the tests to finish
|
||||||
|
group.join()
|
||||||
|
print 'post-join, queue size {size}'.format(size=q.qsize())
|
||||||
|
|
||||||
|
if q.qsize() > 0:
|
||||||
|
for temp_dict in q:
|
||||||
|
if 'error' in temp_dict:
|
||||||
|
raise Exception('exception:\n\t{msg}\n\t{trace}'.format(
|
||||||
|
msg=temp_dict['error']['msg'],
|
||||||
|
trace=temp_dict['error']['traceback'])
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
yaml.safe_dump(temp_dict, stream=real_stdout)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# cleanup
|
# cleanup
|
||||||
|
|
Loading…
Reference in a new issue