Skip to content

Commit

Permalink
Added function for saving test cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Chudnovets committed Jul 15, 2014
1 parent 0a8d785 commit d2f12cb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion benchmark_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def start_locust_slave(slave_ip, slave_user, slave_password, locust_file, host,
def get_timestamp_str(timestamp=None):
if timestamp:
return timestamp.isoformat()
return datetime.datetime.now().isoformat()
return datetime.datetime.now().isoformat().replace('-', '_').replace('.', '_').replace(':', '_')


def store_results(results_dir):
Expand All @@ -98,6 +98,18 @@ def store_results(results_dir):
get_timestamp_str()))


def save_test_cfg(cfg_file, locust_file, results_dir):
dst = os.path.join(results_dir, os.path.basename(cfg_file))
cmd = ['cp', cfg_file, dst]
print ' '.join(cmd)
subprocess.call(cmd, shell=False)

dst = os.path.join(results_dir, os.path.basename(locust_file))
cmd = ['cp', locust_file, dst]
print ' '.join(cmd)
subprocess.call(cmd, shell=False)


def main(cfg_file, locust_file):
cfg = ConfigParser.ConfigParser()
cfg.read(cfg_file)
Expand All @@ -120,6 +132,8 @@ def main(cfg_file, locust_file):
print ("Start loading...")
start_load(cfg, locust_file)

save_test_cfg(cfg_file, locust_file, results_dir)

print ("Saving results...")
store_results(results_dir)

Expand Down

0 comments on commit d2f12cb

Please sign in to comment.