Merge lp:~pfalcon/linaro-android-frontend/lava-requests-fixes into lp:linaro-android-frontend

Proposed by Paul Sokolovsky
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 245
Merged at revision: 244
Proposed branch: lp:~pfalcon/linaro-android-frontend/lava-requests-fixes
Merge into: lp:linaro-android-frontend
Diff against target: 81 lines (+24/-11)
2 files modified
android_build/frontend/api.py (+3/-1)
static/buildDetails.js (+21/-10)
To merge this branch: bzr merge lp:~pfalcon/linaro-android-frontend/lava-requests-fixes
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Review via email: mp+88527@code.launchpad.net

Description of the change

This unbreaks LAVA result display and makes sure we immediately have better clue in case any similar issue arise in the future.

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks good.

Revision history for this message
James Tunnicliffe (dooferlad) :
review: Approve
Revision history for this message
Данило Шеган (danilo) wrote :

Instead of using (typeof something == "undefined") you can use (something === undefined) (triple equality symbol). It's also interesting that you comment out the old-style URL attempts now: what happens with old builds that still have their artefacts on android-build?

Revision history for this message
Данило Шеган (danilo) wrote :

Actually, the above check for undefined won't work with variables directly, sorry.

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

On 13 January 2012 16:43, Данило Шеган <email address hidden> wrote:
> Instead of using (typeof something == "undefined") you can use (something === undefined) (triple equality symbol).  It's also interesting that you comment out the old-style URL attempts now: what happens with old builds that still have their artefacts on android-build?

I was under the impression that we were dropping old builds, which was
why I OK'd the change!

--
James Tunnicliffe

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'android_build/frontend/api.py'
--- android_build/frontend/api.py 2012-01-10 14:39:43 +0000
+++ android_build/frontend/api.py 2012-01-13 16:25:02 +0000
@@ -277,7 +277,9 @@
277 response = urllib2.urlopen(url)277 response = urllib2.urlopen(url)
278 except urllib2.HTTPError, e:278 except urllib2.HTTPError, e:
279 message = "Server error: %d" % e.code279 message = "Server error: %d" % e.code
280 return HttpResponse(message)280 resp = HttpResponse(message)
281 resp.status_code = e.code
282 return resp
281 except urllib2.URLError, e:283 except urllib2.URLError, e:
282 message = "We failed to reach a server."284 message = "We failed to reach a server."
283285
284286
=== modified file 'static/buildDetails.js'
--- static/buildDetails.js 2012-01-10 18:07:20 +0000
+++ static/buildDetails.js 2012-01-13 16:25:02 +0000
@@ -95,11 +95,6 @@
95 }95 }
9696
97 function receivedLavaJobInfo (e, response) {97 function receivedLavaJobInfo (e, response) {
98 if (response.response.match(/^Server error: 404$/))
99 {
100 return; // Nothing to parse
101 }
102
103 if (typeof receivedLavaJobInfo.got_info != "undefined")98 if (typeof receivedLavaJobInfo.got_info != "undefined")
104 {99 {
105 // Don't pass through a second job info. Assumption is that they are the same100 // Don't pass through a second job info. Assumption is that they are the same
@@ -112,13 +107,25 @@
112 receivedLavaJobInfo.got_info = true;107 receivedLavaJobInfo.got_info = true;
113108
114 var job_info = Y.JSON.parse(response.responseText);109 var job_info = Y.JSON.parse(response.responseText);
115 var job_info_json_url = job_info.lava_url + 'scheduler/job/' + job_info.job_id;110 if (typeof job_info.lava_url == "undefined") {
111 Y.one("#testresults").setContent("This build did not undergo LAVA testing.");
112 return;
113 }
114 var job_info_json_url = job_info.lava_url;
115 if (job_info_json_url.substr(job_info_json_url.length - 1) != '/') {
116 job_info_json_url = job_info_json_url + '/';
117 }
118 job_info_json_url = job_info_json_url + 'scheduler/job/' + job_info.job_id;
119 Y.one("#testresults").append("<br/>Requesting LAVA job information...");
116 Y.jsonp(120 Y.jsonp(
117 job_info_json_url + '/json?callback={callback}', 121 job_info_json_url + '/json?callback={callback}',
118 {122 {
119 args: [job_info_json_url],123 args: [job_info_json_url],
120 on: {124 on: {
121 success: receivedJobJSON125 success: receivedJobJSON,
126 failure: function (e) {
127 Y.one("#testresults").append("<br/>Could not load LAVA job data: " + e.msg);
128 }
122 }129 }
123 }130 }
124 );131 );
@@ -179,15 +186,19 @@
179 + rawBuildName + '/' + results.number.toString() + '/lava-job-info';186 + rawBuildName + '/' + results.number.toString() + '/lava-job-info';
180187
181 // Try both locations. File should exist only in one location...188 // Try both locations. File should exist only in one location...
182 Y.io(189/* Y.io(
183 old_style_url,190 old_style_url,
184 {191 {
185 on: { success: receivedLavaJobInfo }192 on: { success: receivedLavaJobInfo }
186 });193 });*/
187 Y.io(194 Y.io(
188 new_style_url,195 new_style_url,
189 {196 {
190 on: { success: receivedLavaJobInfo }197 on: { success: receivedLavaJobInfo,
198 failure: function(id, resp) {
199 Y.one('#testresults').append('<br/>Could not load lava-job-info: ' + resp.responseText);
200 }
201 }
191 });202 });
192203
193 return 'Loading...';204 return 'Loading...';

Subscribers

People subscribed via source and target branches