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
1=== modified file 'android_build/frontend/api.py'
2--- android_build/frontend/api.py 2012-01-10 14:39:43 +0000
3+++ android_build/frontend/api.py 2012-01-13 16:25:02 +0000
4@@ -277,7 +277,9 @@
5 response = urllib2.urlopen(url)
6 except urllib2.HTTPError, e:
7 message = "Server error: %d" % e.code
8- return HttpResponse(message)
9+ resp = HttpResponse(message)
10+ resp.status_code = e.code
11+ return resp
12 except urllib2.URLError, e:
13 message = "We failed to reach a server."
14
15
16=== modified file 'static/buildDetails.js'
17--- static/buildDetails.js 2012-01-10 18:07:20 +0000
18+++ static/buildDetails.js 2012-01-13 16:25:02 +0000
19@@ -95,11 +95,6 @@
20 }
21
22 function receivedLavaJobInfo (e, response) {
23- if (response.response.match(/^Server error: 404$/))
24- {
25- return; // Nothing to parse
26- }
27-
28 if (typeof receivedLavaJobInfo.got_info != "undefined")
29 {
30 // Don't pass through a second job info. Assumption is that they are the same
31@@ -112,13 +107,25 @@
32 receivedLavaJobInfo.got_info = true;
33
34 var job_info = Y.JSON.parse(response.responseText);
35- var job_info_json_url = job_info.lava_url + 'scheduler/job/' + job_info.job_id;
36+ if (typeof job_info.lava_url == "undefined") {
37+ Y.one("#testresults").setContent("This build did not undergo LAVA testing.");
38+ return;
39+ }
40+ var job_info_json_url = job_info.lava_url;
41+ if (job_info_json_url.substr(job_info_json_url.length - 1) != '/') {
42+ job_info_json_url = job_info_json_url + '/';
43+ }
44+ job_info_json_url = job_info_json_url + 'scheduler/job/' + job_info.job_id;
45+ Y.one("#testresults").append("<br/>Requesting LAVA job information...");
46 Y.jsonp(
47 job_info_json_url + '/json?callback={callback}',
48 {
49 args: [job_info_json_url],
50 on: {
51- success: receivedJobJSON
52+ success: receivedJobJSON,
53+ failure: function (e) {
54+ Y.one("#testresults").append("<br/>Could not load LAVA job data: " + e.msg);
55+ }
56 }
57 }
58 );
59@@ -179,15 +186,19 @@
60 + rawBuildName + '/' + results.number.toString() + '/lava-job-info';
61
62 // Try both locations. File should exist only in one location...
63- Y.io(
64+/* Y.io(
65 old_style_url,
66 {
67 on: { success: receivedLavaJobInfo }
68- });
69+ });*/
70 Y.io(
71 new_style_url,
72 {
73- on: { success: receivedLavaJobInfo }
74+ on: { success: receivedLavaJobInfo,
75+ failure: function(id, resp) {
76+ Y.one('#testresults').append('<br/>Could not load lava-job-info: ' + resp.responseText);
77+ }
78+ }
79 });
80
81 return 'Loading...';

Subscribers

People subscribed via source and target branches