Fix yardstick.out overwritten bug 59/959/3
authorpanghao1 <shamrock.pang@huawei.com>
Tue, 30 Jun 2015 04:10:11 +0000 (04:10 +0000)
committerpanghao1 <shamrock.pang@huawei.com>
Wed, 15 Jul 2015 01:55:40 +0000 (01:55 +0000)
The output of scenarios will be appended to the yardstick.out file.

JIRA: YARDSTICK-45

Change-Id: I185c6d2a8a534c8bb2b731bb84c47bdf4bad4427
Signed-off-by: panghao1 <shamrock.pang@huawei.com>
yardstick/benchmark/runners/base.py
yardstick/cmd/commands/task.py

index badc335..30fa076 100644 (file)
@@ -25,7 +25,7 @@ def _output_serializer_main(filename, queue):
     Use of this process enables multiple instances of a scenario without
     messing up the output file.
     '''
-    with open(filename, 'w') as outfile:
+    with open(filename, 'a+') as outfile:
         while True:
             # blocks until data becomes available
             record = queue.get()
index d562256..8b9f269 100644 (file)
@@ -10,6 +10,7 @@
 """ Handler for yardstick command 'task' """
 
 import sys
+import os
 import yaml
 import atexit
 import pkg_resources
@@ -47,6 +48,9 @@ class TaskCommands(object):
         if args.parse_only:
             sys.exit(0)
 
+        if os.path.isfile(args.output_file):
+            os.remove(args.output_file)
+
         for context in Context.list:
             context.deploy()