forked from tobami/codespeed
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsave_multiple_results.py
More file actions
52 lines (45 loc) · 1.27 KB
/
save_multiple_results.py
File metadata and controls
52 lines (45 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
####################################################
# Sample script that shows how to save result data using json #
####################################################
import urllib
import urllib2
import json
# You need to enter the real URL and have the server running
CODESPEED_URL = 'http://localhost:8000/'
sample_data = [
{
"commitid": "8",
"project": "MyProject",
"branch": "default",
"executable": "myexe O3 64bits",
"benchmark": "float",
"environment": "Dual Core",
"result_value": 2500.0
},
{
"commitid": "8",
"project": "MyProject",
"branch": "default",
"executable": "myexe O3 64bits",
"benchmark": "int",
"environment": "Dual Core",
"result_value": 1100
}
]
def add(data):
#params = urllib.urlencode(data)
response = "None"
try:
f = urllib2.urlopen(
CODESPEED_URL + 'result/add/json/', urllib.urlencode(data))
except urllib2.HTTPError as e:
print str(e)
print e.read()
return
response = f.read()
f.close()
print "Server (%s) response: %s\n" % (CODESPEED_URL, response)
if __name__ == "__main__":
data = {'json': json.dumps(sample_data)}
add(data)