From bb50e1acf02dd4ec3c084f27a5336e87c9ad1bee Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 13 Apr 2017 12:31:32 +0200 Subject: Use functions in generate-config.py --- elastic/generate-config.py | 47 +++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'elastic/generate-config.py') diff --git a/elastic/generate-config.py b/elastic/generate-config.py index f26d03d..e5e8547 100755 --- a/elastic/generate-config.py +++ b/elastic/generate-config.py @@ -6,7 +6,7 @@ import pystache tests = [ 'test_encrypt_raw_10M', - # 'test_encrypt_raw_100k', + 'test_encrypt_raw_100k', # 'test_encrypt_raw_10k', # 'test_decrypt_raw_100k', # 'test_decrypt_raw_10M', @@ -27,21 +27,42 @@ tests = [ #'test_decrypt_doc_1M' ] -DIR = './visualization/' -template = open(DIR + 'template.mustache', 'r').read() -for test in tests: - out_file = DIR + test + '.json' +# Generate visualizations +def generate_visualizations(): + dir = './visualization/' + template = open(dir + 'template.mustache', 'r').read() + + for test in tests: + out_file = dir + test + '.json' + print('Generating ' + out_file) + context = { + 'title': test, + 'query': "commit_info.project:soledad AND commit_info.branch='master' AND machine_info.host='weasel' AND name='" + test + "'" + } + + rendered = pystache.render(template, context) + #print(context) + + out = open(out_file, 'w') + out.write(rendered) + out.flush() + +# Generate Dashboard +def generate_dashboards(): + dir = './dashboard/' + template = open(dir + 'template.mustache', 'r').read() + out_file = dir + test + '.json' print('Generating ' + out_file) - context = { - 'title': test, - 'query': "commit_info.project:soledad AND commit_info.branch='master' AND machine_info.host='weasel' AND name='" + test + "'" - } + + item = q + + for test in tests: + dashboards = dashboards + '' rendered = pystache.render(template, context) - #print(context) + print(rendered) - out = open(out_file, 'w') - out.write(rendered) - out.flush() +generate_visualizations() +#generate_dashboards() -- cgit v1.2.3