summaryrefslogtreecommitdiff
path: root/elastic/generate-config.py
diff options
context:
space:
mode:
Diffstat (limited to 'elastic/generate-config.py')
-rwxr-xr-xelastic/generate-config.py53
1 files changed, 39 insertions, 14 deletions
diff --git a/elastic/generate-config.py b/elastic/generate-config.py
index 6facbd2..9ff1210 100755
--- a/elastic/generate-config.py
+++ b/elastic/generate-config.py
@@ -10,7 +10,7 @@ import pystache
import requests
-URL='https://moose.leap.se:9200'
+URL = 'https://moose.leap.se:9200'
def _get_logger():
@@ -32,11 +32,21 @@ def _delete_jsons(directory):
def generate_visualizations(tests):
with open(os.path.join('templates', 'visualization.mustache'), 'r') as f:
template = f.read()
- with open(os.path.join('templates', 'visualization-visState-time.mustache')) as f:
+
+ path = os.path.join('templates', 'visualization-visState-time.mustache')
+ with open(path) as f:
template_visState_time = f.read()
- with open(os.path.join('templates', 'visualization-visState-resources.mustache')) as f:
- template_visState_resources = f.read()
- with open(os.path.join('templates', 'visualization-searchSourceJSON.mustache')) as f:
+
+ path = os.path.join('templates', 'visualization-visState-cpu.mustache')
+ with open(path) as f:
+ template_visState_cpu = f.read()
+
+ path = os.path.join('templates', 'visualization-visState-memory.mustache')
+ with open(path) as f:
+ template_visState_memory = f.read()
+
+ path = os.path.join('templates', 'visualization-searchSourceJSON.mustache')
+ with open(path) as f:
template_searchSourceJSON = f.read()
out_dir = './visualization'
@@ -49,7 +59,8 @@ def generate_visualizations(tests):
graphs = [
('time', 'Time taken by ', 'weasel', template_visState_time),
- ('resources', 'Resources consumed by ', 'weasel', template_visState_resources)
+ ('cpu', 'CPU percentage used by ', 'weasel', template_visState_cpu),
+ ('memory', 'Memory used by ', 'weasel', template_visState_memory)
]
for test_name in tests:
@@ -59,20 +70,33 @@ def generate_visualizations(tests):
out_file = os.path.join(out_dir, test_name + '_' + type + '.json')
logger.info('Generating ' + out_file)
+ query = "commit_info.project:soledad" \
+ " AND machine_info.host='" + host + "'" \
+ " AND name='" + test_name + "'"
+# " AND commit_info.branch='master'"
+
+ # results that are accurate for time are not accurate for memory,
+ # and vice versa.
+ if type == 'time' or type == 'cpu':
+ query += " AND NOT _exists_:extra_info.memory_percent"
+ else:
+ query += " AND _exists_:extra_info.memory_percent"
+
+ if type == 'cpu':
+ query += " AND _exists_:extra_info.cpu_percent"
+
context = {
- 'title': title + test_name,
- 'test_name': test_name,
- 'query': "commit_info.project:soledad "
-# "AND commit_info.branch='master' "
- "AND machine_info.host='" + host + "' "
- "AND name='" + test_name + "'"
+ 'title': title + test_name,
+ 'test_name': test_name,
+ 'query': query,
}
visState = pystache.render(template_visState, context)
assert json.loads(visState)
context['visState'] = json.dumps(visState)
- searchSourceJSON = pystache.render(template_searchSourceJSON, context)
+ searchSourceJSON = pystache.render(
+ template_searchSourceJSON, context)
assert json.loads(searchSourceJSON)
context['searchSourceJSON'] = json.dumps(searchSourceJSON)
@@ -119,7 +143,8 @@ def _dashboard_for_all_tests(tests):
def _dashboard_for_one_test(test):
- with open(os.path.join('templates', 'dashboard-per-test.mustache'), 'r') as f:
+ path = os.path.join('templates', 'dashboard-per-test.mustache')
+ with open(path, 'r') as f:
template = f.read()
context = {'test_name': test}
rendered = pystache.render(template, context)