~juju-qa/juju-ci-tools/trunk

« back to all changes in this revision

Viewing changes to deploy_stack.py

  • Committer: Christopher Lee
  • Date: 2017-04-05 23:07:51 UTC
  • mfrom: (1938.3.28 timing_bootstrap)
  • Revision ID: chris.lee@canonical.com-20170405230751-pj0l3y2anyczvcb5
Merge the CommandTiming and CommandComplete work for timing commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
    from contextlib import nested
9
9
except ImportError:
10
10
    from contextlib import ExitStack as nested
11
 
 
12
11
import glob
13
12
import logging
14
13
import os
18
17
import subprocess
19
18
import sys
20
19
import time
21
 
import json
 
20
import yaml
22
21
import shutil
23
22
 
24
23
from chaos import background_chaos
249
248
 
250
249
def dump_juju_timings(client, log_directory):
251
250
    try:
252
 
        with open(os.path.join(log_directory, 'juju_command_times.json'),
253
 
                  'w') as timing_file:
254
 
            json.dump(client.get_juju_timings(), timing_file, indent=2,
255
 
                      sort_keys=True)
 
251
        report_path = os.path.join(log_directory, 'juju_command_times.yaml')
 
252
        with open(report_path, 'w') as timing_file:
 
253
            yaml.safe_dump(
 
254
                client.get_juju_timings(),
 
255
                timing_file)
256
256
            timing_file.write('\n')
257
257
    except Exception as e:
258
258
        print_now("Failed to save timings")