Merge branch 'master' of https://github.com/Mirantis/rally-results-processor
diff --git a/data_generator.py b/data_generator.py
new file mode 100644
index 0000000..3692389
--- /dev/null
+++ b/data_generator.py
@@ -0,0 +1,29 @@
+import sys
+import uuid
+import random
+import itertools
+
+from petname import Generate as pet_generate
+from storage_api import create_storage
+
+
+types = ["GA", "master"] + [pet_generate(2, '-') for _ in range(10)]
+random.shuffle(types)
+tp = itertools.cycle(types)
+
+sz = ["4k", "64k", "1m"]
+op_type = ["randread", "read", "randwrite", "write"]
+is_sync = ["s", "a"]
+
+storage = create_storage(sys.argv[1])
+
+for i in range(30):
+ row = {"build_id": pet_generate(2, " "),
+ "type": next(tp),
+ "iso_md5": uuid.uuid4().get_hex()}
+
+ for sz, op_type, is_sync in itertools.product(op_type, is_sync, sz):
+ row[" ".join([sz, op_type, is_sync])] = (random.random(),
+ random.random() / 5)
+
+ storage.store(row)
diff --git a/fix_rally_subnets.sh b/fix_rally_subnets.sh
deleted file mode 100644
index b1073d4..0000000
--- a/fix_rally_subnets.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-port_ids=$(neutron port-list | tail -n+4 | head -n-1 | awk '{print $2}')
-
-for port_id in $port_ids; do
- neutron port-delete $port_id
-done
-
-subnet_list=$(neutron subnet-list | grep rally | awk '{print $2}')
-
-for subnet_id in $subnet_id; do
- neutron subnet-delete $subnet_id
-done
-
-net_ids=$(neutron net-list | grep rally | awk '{print $2}')
-
-for net_id in $net_ids; do
- neutron net-delete $net_id
-done
diff --git a/requirements.txt b/requirements.txt
index bedadd8..f3fd43f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,2 @@
argparse==1.2.1
-gspread==0.2.2
wsgiref==0.1.2
diff --git a/storage_api.py b/storage_api.py
index a7e9cf2..7af126d 100644
--- a/storage_api.py
+++ b/storage_api.py
@@ -1,7 +1,8 @@
from urlparse import urlparse
-from gspread import WorksheetNotFound, login
+# from gspread import WorksheetNotFound, login
import json
import os
+from gspread import login
from config import ROW_COUNT, DOCUMENT_ID, WORK_SHEET
@@ -48,16 +49,20 @@
"": (float, float)
}
+ def __str__(self):
+ return self.build + " " + self.build_type + " " + \
+ self.md5 + " " + str(self.results)
-def create_storage(url, email, password):
- u = urlparse(url)
- if u.scheme == 'file':
- storage = DiskStorage(u.path)
- else:
- storage = GoogleDocsStorage(DOCUMENT_ID, WORK_SHEET, email, password)
+def create_storage(url, email=None, password=None):
+ u = urlparse(url)
- return storage
+ if u.scheme == 'file':
+ storage = DiskStorage(u.path)
+ else:
+ storage = GoogleDocsStorage(DOCUMENT_ID, WORK_SHEET, email, password)
+
+ return storage
class Storage(object):
@@ -149,7 +154,7 @@
m.build = row.pop("build_id")
m.build_type = row.pop("type")
m.md5 = row.pop("iso_md5")
- m.results = {k: row[k] for k in row.keys()}
+ m.results = {k.split(" "): row[k] for k in row.keys()}
return m
return None
@@ -160,20 +165,25 @@
document = json.loads(raw_data)
d = {}
result = []
+ build_types = {"GA", "master"}
for i in range(len(document) - 1, -1, - 1):
- if document[i]["type"] not in d:
- d[document[i]["type"]] = document[i]
+ if document[i]["type"] in build_types:
+ if document[i]["type"] not in d:
+ d[document[i]["type"]] = document[i]
+ elif "other" not in d:
+ d["other"] = document[i]
for k in d.keys():
m = Measurement()
m.build = d[k].pop("build_id")
m.build_type = d[k].pop("type")
m.md5 = d[k].pop("iso_md5")
- m.results = {k: d[key] for key in d.keys()}
+ m.results = {k: v for k, v in d[k].items()}
result.append(m)
- return d
+ return result
if __name__ == "__main__":
- create_storage("file:///home/gstepanov/bla?email=aaa.gmail.com&password=1234")
\ No newline at end of file
+ storage = create_storage("file:///home/gstepanov/rally-results-processor/sample.json", "", "")
+ print storage.recent_builds()