diff options
author | Clark Laughlin <clark.laughlin@linaro.org> | 2015-05-28 12:23:49 -0400 |
---|---|---|
committer | Clark Laughlin <clark.laughlin@linaro.org> | 2015-05-28 12:23:49 -0400 |
commit | 770a53049991589b49a4353d7d91c7f12fa77540 (patch) | |
tree | 3e13086bd1135cf2823185ed9a605ccd9f67a45d | |
parent | 71b031e33051a99c861044dc4f3d574cba3d46be (diff) |
support for device
-rw-r--r-- | web-app/server.go | 61 | ||||
-rw-r--r-- | web-app/static/chart.js | 8 | ||||
-rw-r--r-- | web-app/static/detail.html | 8 | ||||
-rw-r--r-- | web-app/static/index.html | 30 |
4 files changed, 74 insertions, 33 deletions
diff --git a/web-app/server.go b/web-app/server.go index 703b879..4b72ba6 100644 --- a/web-app/server.go +++ b/web-app/server.go @@ -24,6 +24,7 @@ func Results_AllCategorization(w http.ResponseWriter, r *http.Request) { unionres := struct { Branch interface{} OS interface{} + Device interface{} }{} db, err := neoism.Connect(*neo4j_server) @@ -67,9 +68,26 @@ func Results_AllCategorization(w http.ResponseWriter, r *http.Request) { log.Println("query error: ", err) } + // devices + + resDevices := [] struct { + Name string `json:"n.name"` + Occurances int32 `json:"occurances"` + }{} + + cq3 := neoism.CypherQuery{ + Statement: `MATCH (n:Device)-[:ON]-(x) RETURN n.name, count(x) as occurances ORDER BY occurances DESC`, + Result: &resDevices, + } + + err = db.Cypher(&cq3) + if err != nil { + log.Println("query error: ", err) + } unionres.Branch = resBranches unionres.OS = resOSes + unionres.Device = resDevices enc := json.NewEncoder(w) enc.Encode(unionres) @@ -87,6 +105,7 @@ func Results_Tempest_Summary(w http.ResponseWriter, r *http.Request) { Number_Of_Runs int32 `json:"Number_Of_Runs"` OS_Name string `json:"OS_Name"` Branch string `json:"Branch"` + Device string `json:"Device"` Average_Pct_Failing float64 `json:"Average_Pct_Failing"` Average_Pct_Passing float64 `json:"Average_Pct_Passing"` Average_Pct_Skipped float64 `json:"Average_Pct_Skipped"` @@ -94,7 +113,10 @@ func Results_Tempest_Summary(w http.ResponseWriter, r *http.Request) { cq := neoism.CypherQuery{ Statement: `MATCH (b:Branch)<-[:USING]-(t:Tempest:Run)-[:ON]->(o:OS) - RETURN count(t) as Number_Of_Runs, o.name as OS_Name, b.name as Branch, + WITH t,b,o + MATCH (d:Device)<-[:ON]-(t:Tempest:Run) + RETURN count(t) as Number_Of_Runs, + d.name as Device, o.name as OS_Name, b.name as Branch, ROUND(avg(toFloat(t.failing_tests)/t.tests_run) * 100) as Average_Pct_Failing, ROUND(avg(toFloat(t.passing_tests)/t.tests_run) * 100) as Average_Pct_Passing, ROUND(avg(toFloat(t.skipped_tests)/t.tests_run) * 100) as Average_Pct_Skipped`, @@ -134,6 +156,7 @@ func Results_Tempest_SinglePermutation(w http.ResponseWriter, r *http.Request) { //log.Println("osdistro=",mux.Vars(r)["osdistro"]) //log.Println("osversion=",mux.Vars(r)["osversion"]) //log.Println("branch=",mux.Vars(r)["branch"]) + //log.Println("device=",mux.Vars(r)["device"]) db, err := neoism.Connect(*neo4j_server) if err != nil { @@ -152,19 +175,28 @@ func Results_Tempest_SinglePermutation(w http.ResponseWriter, r *http.Request) { OS_Distro string `json:"o.distro"` OS_Version string `json:"o.version"` Branch string `json:"b.name"` - Epoch_time int64 `json:"t.epoch_time"` + Device string `json:"d.name"` + Epoch_time int64 `json:"t.epoch_time"` }{} cq := neoism.CypherQuery{ Statement: `MATCH (b:Branch)<-[:USING]-(t:Tempest:Run)-[:ON]->(o:OS) + WITH t,b,o + MATCH (d:Device)<-[:ON]-(t:Tempest:Run) WHERE o.distro = {osdistro} AND o.version = {osversion} - AND b.name = {branch} + AND b.name = {branch} AND d.name = {device} RETURN t.lava_job, t.date, t.sha1, t.all_tests, t.passing_tests, t.failing_tests, t.tests_run, t.skipped_tests, - t.epoch_time, o.distro, o.version, b.name + t.epoch_time, o.distro, o.version, b.name, d.name ORDER BY t.epoch_time DESC LIMIT {count}`, - Parameters: neoism.Props{"count": count, "osdistro": mux.Vars(r)["osdistro"], "osversion": mux.Vars(r)["osversion"], "branch": mux.Vars(r)["branch"]}, + Parameters: neoism.Props{ + "count": count, + "osdistro": mux.Vars(r)["osdistro"], + "osversion": mux.Vars(r)["osversion"], + "branch": mux.Vars(r)["branch"], + "device": mux.Vars(r)["device"], + }, Result: &res, } @@ -266,17 +298,20 @@ func Results_Tempest_Job_Summary(w http.ResponseWriter, r *http.Request) { Skipped_tests int32 `json:"t.skipped_tests"` OS_Distro string `json:"o.distro"` OS_Version string `json:"o.version"` - Branch string `json:"b.name"` + Device string `json:"d.name"` + Branch string `json:"b.name"` Epoch_time int64 `json:"t.epoch_time"` }{} cq := neoism.CypherQuery{ Statement: `MATCH (b:Branch)<-[:USING]-(t:Tempest:Run)-[:ON]->(o:OS) + WITH t,b,o + MATCH (d:Device)<-[:ON]-(t:Tempest:Run) WHERE t.lava_job = {job} RETURN t.lava_job, t.date, t.sha1, t.all_tests, t.passing_tests, t.failing_tests, t.tests_run, t.skipped_tests, - t.epoch_time, o.distro, o.version, b.name`, + t.epoch_time, o.distro, o.version, b.name, d.name`, Parameters: neoism.Props{"job": job}, Result: &res, } @@ -306,7 +341,7 @@ func Results_Tempest_AllJobIds(w http.ResponseWriter, r *http.Request) { }{} cq := neoism.CypherQuery{ - Statement: `MATCH (n:TempestRun) WITH n.lava_job AS lava_job ORDER BY n.epoch_time DESC + Statement: `MATCH (n:Tempest:Run) WITH n.lava_job AS lava_job ORDER BY n.epoch_time DESC RETURN COLLECT(lava_job) as lava_job_ids`, Result: &res, } @@ -498,14 +533,14 @@ func main() { s.HandleFunc("/all-categorization", Results_AllCategorization) // tempest - s.HandleFunc("/tempest", Results_Tempest_SinglePermutation).Queries("count", "{count:[0-9]+}", "branch", "{branch}", "osdistro", "{osdistro}", "osversion", "{osversion}") + s.HandleFunc("/tempest", Results_Tempest_SinglePermutation).Queries("count", "{count:[0-9]+}", "branch", "{branch}", "device", "{device}", "osdistro", "{osdistro}", "osversion", "{osversion}") s.HandleFunc("/tempest/unfiltered", Results_Tempest_LastN).Queries("count", "{count:[0-9]+}") // DONE s.HandleFunc("/tempest/summary", Results_Tempest_Summary) // DONE s.HandleFunc("/tempest/jobs", Results_Tempest_AllJobIds) // DONE - s.HandleFunc("/tempest/operating-system/{osdistro}/{osversion}", Results_Tempest_OS).Queries("count", "{count:[0-9]+}") - s.HandleFunc("/tempest/operating-system/{osdistro}/{osversion}", Results_Tempest_OS_Summary) - s.HandleFunc("/tempest/branch/{branch}", Results_Tempest_Branch).Queries("count", "{count:[0-9]+}") - s.HandleFunc("/tempest/branch/{branch}", Results_Tempest_Branch_Summary) + //s.HandleFunc("/tempest/operating-system/{osdistro}/{osversion}", Results_Tempest_OS).Queries("count", "{count:[0-9]+}") + //s.HandleFunc("/tempest/operating-system/{osdistro}/{osversion}", Results_Tempest_OS_Summary) + //s.HandleFunc("/tempest/branch/{branch}", Results_Tempest_Branch).Queries("count", "{count:[0-9]+}") + //s.HandleFunc("/tempest/branch/{branch}", Results_Tempest_Branch_Summary) s.HandleFunc("/tempest/job/{job:[0-9]+}", Results_Tempest_Job_Summary) // DONE s.HandleFunc("/tempest/job/{job:[0-9]+}/failures", Results_Tempest_Job_Failures) // DONE //s.HandleFunc("/tempest/job/{job:[0-9]+}/failures/{test}", Results_Tempest_Job_Test_Failure) diff --git a/web-app/static/chart.js b/web-app/static/chart.js index 29a2190..1632ea9 100644 --- a/web-app/static/chart.js +++ b/web-app/static/chart.js @@ -1,8 +1,8 @@ -function create_chart(div_name, branch, distro, version, max_results, f) { - var div_name = branch + ":" + distro + ":" + version; +function create_chart(div_name, branch, device, distro, version, max_results, f) { + var div_name = branch + ":" + device + ":" + distro + ":" + version; - $.getJSON( "/results/tempest?count=" + max_results + "&branch=" + branch + "&osdistro=" + distro + "&osversion=" + version, function(data) { + $.getJSON( "/results/tempest?count=" + max_results + "&branch=" + branch + "&device=" + device + "&osdistro=" + distro + "&osversion=" + version, function(data) { var failureDataPoints = []; var skippedDataPoints = []; var passingDataPoints = []; @@ -19,7 +19,7 @@ function create_chart(div_name, branch, distro, version, max_results, f) { { title: { fontSize: 20, - text: "Branch \"" + branch + "\" on \"" + distro + "/" + version + "\" (up to last " + max_results + " results)" + text: "Branch \"" + branch + "\" on \"" + device + "\" running \"" + distro + "/" + version + "\" (up to last " + max_results + " results)" }, legend: { cursor: "pointer", diff --git a/web-app/static/detail.html b/web-app/static/detail.html index 3f842b4..456e666 100644 --- a/web-app/static/detail.html +++ b/web-app/static/detail.html @@ -47,6 +47,7 @@ $(function() { $("#branch").text(item["b.name"]); $("#os_distro").text(item["o.distro"]); $("#os_version").text(item["o.version"]); + $("#device").text(item["d.name"]); $("#passing_tests").text(item["t.passing_tests"]); $("#failing_tests").text(item["t.failing_tests"]); @@ -110,6 +111,7 @@ Openstack CI</h1> <table> <tr><td>Tested Branch:</td><td><strong><span id="branch"></span></strong></td></tr> +<tr><td>Device:</td><td><strong><span id="device"></span></strong></td></tr> <tr><td>OS Distro / Version:</td><td><strong><span id="os_distro"></span> / <span id="os_version"></span></strong></td></tr> </table> @@ -123,12 +125,12 @@ Openstack CI</h1> </table> <h2>Logs</h2> -Click here to view the log output: <span id="lava_job"></span> +Click here to view the log output: <u>Coming Soon</u> -<h3>Failing Tests</h3> +<h2>Failing Tests</h2> <table id="failing_tests_table" class="display" cellspacing="0" width="100%"></table> -<h3>Skipped Tests</h3> +<h2>Skipped Tests</h2> <table id="skipped_tests_table" class="display" cellspacing="0" width="100%"></table> </body> diff --git a/web-app/static/index.html b/web-app/static/index.html index 191d20b..390580f 100644 --- a/web-app/static/index.html +++ b/web-app/static/index.html @@ -34,8 +34,9 @@ $(function() { "autowidth" : false, "ajax": { "dataSrc" : "", "url" : "/results/tempest/summary" }, "columns": [ - { "title" : "OS Distro / Version", "data" : "OS_Name" }, { "title" : "Branch", "data" : "Branch" }, + { "title" : "OS Distro / Version", "data" : "OS_Name" }, + { "title" : "Device", "data" : "Device" }, { "title" : "# Of Test Runs", "data" : "Number_Of_Runs" }, { "title" : "Average Passing (%)", "data" : "Average_Pct_Passing" }, { "title" : "Average Failing (%)", "data" : "Average_Pct_Failing" }, @@ -48,19 +49,22 @@ $(function() { $.getJSON("/results/all-categorization", function(data) { data['Branch'].forEach(function(value, index) { var branch = value['n.name']; - data['OS'].forEach(function(value, index) { - var distro = value['n.distro']; - var version = value['n.version']; - var div_name = branch + ":" + distro + ":" + version; + data['Device'].forEach(function(value, index) { + var device = value['n.name']; + data['OS'].forEach(function(value, index) { + var distro = value['n.distro']; + var version = value['n.version']; + var div_name = branch + ":" + device + ":" + distro + ":" + version; - $("<div>", { - 'id': div_name, - css: { "height": "450px", "width": "90%" } - }).appendTo($("#chartContainer")); - $("<br>").appendTo($("#chartContainer")); - - // generate a chart for the combination - create_chart(div_name, branch, distro, version, 60, handle_chart_click); + $("<div>", { + 'id': div_name, + css: { "height": "450px", "width": "90%" } + }).appendTo($("#chartContainer")); + $("<br>").appendTo($("#chartContainer")); + + // generate a chart for the combination + create_chart(div_name, branch, device, distro, version, 60, handle_chart_click); + }); }); }); }); |