]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
readwrite: error propagation code
authorJoe Buck <jbbuck@gmail.com>
Fri, 9 Aug 2013 04:47:34 +0000 (21:47 -0700)
committerJoe Buck <jbbuck@gmail.com>
Tue, 13 Aug 2013 06:32:59 +0000 (23:32 -0700)
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>
s3tests/readwrite.py

index d3b680e2e48c108260bdbd551cda1c042bc95606..cdfcf17793c69749764ec07dd1f7cfee7c9fde29 100644 (file)
@@ -55,13 +55,13 @@ def reader(bucket, worker_id, file_names, queue, rand):
                         msg='md5sum check failed',
                         ),
                     )
-
-        elapsed = end - start
-        result.update(
-            start=start,
-            duration=int(round(elapsed * NANOSECOND)),
-            chunks=fp.chunks,
-            )
+            else:
+                elapsed = end - start
+                result.update(
+                    start=start,
+                    duration=int(round(elapsed * NANOSECOND)),
+                    chunks=fp.chunks,
+                    )
         queue.put(result)
 
 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:
             end = time.time()
 
-        elapsed = end - start
-        result.update(
-            start=start,
-            duration=int(round(elapsed * NANOSECOND)),
-            chunks=fp.last_chunks,
-            )
+            elapsed = end - start
+            result.update(
+                start=start,
+                duration=int(round(elapsed * NANOSECOND)),
+                chunks=fp.last_chunks,
+                )
+
         queue.put(result)
 
 def parse_options():
@@ -241,7 +242,19 @@ def main():
             q.put(StopIteration)
         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:
         # cleanup