Author: Matti Picus <[email protected]>
Branch:
Changeset: r379:9a13486fa4c7
Date: 2019-04-18 10:41 +0300
http://bitbucket.org/pypy/benchmarks/changeset/9a13486fa4c7/
Log: minimum changes to save results on newer codespeed, more
improvements possible
diff --git a/savecpython.py b/savecpython.py
--- a/savecpython.py
+++ b/savecpython.py
@@ -37,21 +37,20 @@
else:
print("ERROR: result type unknown " + b[1])
return 1
- data = {
+ data = [{
'commitid': revision,
'project': project,
'executable': executable,
'benchmark': bench_name,
'environment': host,
'result_value': value,
- 'result_date': current_date,
'branch': 'default',
- }
+ }]
if res_type == "ComparisonResult":
if base:
- data['std_dev'] = results['std_base']
+ data[0]['std_dev'] = results['std_base']
else:
- data['std_dev'] = results['std_changed']
+ data[0]['std_dev'] = results['std_changed']
if testing: testparams.append(data)
else: send(data)
if testing: return testparams
@@ -59,14 +58,14 @@
def send(data):
#save results
- params = urllib.urlencode(data)
+ params = urllib.urlencode({'json': json.dumps(data)})
f = None
response = "None"
- info = str(datetime.today()) + ": Saving result for " + data['executable']
+ " revision "
- info += str(data['commitid']) + ", benchmark " + data['benchmark']
+ info = str(datetime.today()) + ": Saving result for " +
data[0]['executable'] + " revision "
+ info += str(data[0]['commitid']) + ", benchmark " + data[0]['benchmark']
print(info)
try:
- f = urllib2.urlopen(SPEEDURL + 'result/add/', params)
+ f = urllib2.urlopen(SPEEDURL + 'result/add/json/', params)
response = f.read()
f.close()
except urllib2.URLError, e:
diff --git a/saveresults.py b/saveresults.py
--- a/saveresults.py
+++ b/saveresults.py
@@ -27,6 +27,7 @@
import time
import urllib
import urllib2
+import json
def save(project, revision, results, executeable, host, url, testing=False,
@@ -62,7 +63,7 @@
else:
print("ERROR: result type unknown " + b[1])
return 1
- data = {
+ data = [{
'commitid': revision,
'project': project,
'executable': executeable,
@@ -70,15 +71,15 @@
'environment': host,
'result_value': value,
'branch': branch,
- }
+ }]
if value is None:
print "Ignoring skipped result", data
continue
if res_type == "ComparisonResult":
if changed:
- data['std_dev'] = results['std_changed']
+ data[0]['std_dev'] = results['std_changed']
else:
- data['std_dev'] = results['std_base']
+ data[0]['std_dev'] = results['std_base']
if testing:
testparams.append(data)
else:
@@ -94,19 +95,22 @@
def send(data, url):
#save results
- params = urllib.urlencode(data)
+ params = urllib.urlencode({'json': json.dumps(data)})
f = None
response = "None"
info = ("%s: Saving result for %s revision %s, benchmark %s" %
- (str(datetime.today()), data['executable'],
- str(data['commitid']), data['benchmark']))
+ (str(datetime.today()), data[0]['executable'],
+ str(data[0]['commitid']), data[0]['benchmark']))
print(info)
try:
retries = [1, 2, 3, 6]
while True:
try:
- f = urllib2.urlopen(url + 'result/add/', params)
+ print('result/add')
+ f = urllib2.urlopen(url + 'result/add/json/', params)
+ print('urlopen')
response = f.read()
+ print('response')
f.close()
break
except urllib2.URLError:
@@ -163,7 +167,7 @@
parser.add_option('-u', '--url', dest='url',
default="http://speed.pypy.org/",
help=('Url of the codespeed instance '
- '(default: http://speed.pypy.org)'))
+ '(default: http://speed.pypy.org/)'))
parser.format_description = lambda fmt: __doc__
parser.description = __doc__
options, args = parser.parse_args()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit