You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/05/19 02:03:19 UTC

hbase git commit: HBASE-18076 Flaky dashboard improvement: Add status markers to show trends of failure/success.

Repository: hbase
Updated Branches:
  refs/heads/master 958cd2d1b -> c51c36fd1


HBASE-18076 Flaky dashboard improvement: Add status markers to show trends of failure/success.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c51c36fd
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c51c36fd
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c51c36fd

Branch: refs/heads/master
Commit: c51c36fd1fe5d4424c6d53fec1f8429725706d30
Parents: 958cd2d
Author: Apekshit Sharma <ap...@apache.org>
Authored: Thu May 18 16:53:28 2017 -0700
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Thu May 18 19:03:11 2017 -0700

----------------------------------------------------------------------
 dev-support/flaky-dashboard-template.html | 60 +++++++++++++++++++++++++-
 dev-support/report-flakies.py             | 14 +++---
 2 files changed, 68 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c51c36fd/dev-support/flaky-dashboard-template.html
----------------------------------------------------------------------
diff --git a/dev-support/flaky-dashboard-template.html b/dev-support/flaky-dashboard-template.html
index b980b5d..88a7720 100644
--- a/dev-support/flaky-dashboard-template.html
+++ b/dev-support/flaky-dashboard-template.html
@@ -41,6 +41,56 @@
     </style>
 </head>
 <body>
+    <script src="http://d3js.org/d3.v3.min.js"></script>
+    <script>
+        var width = 300;
+        var height = 25;
+        var x = d3.scale.linear().range([0, width]);
+
+        function csvToArray(csv) {
+            if (csv.length == 0)
+                return [];
+            splits = csv.split(",");
+            ret = [];
+            for (i = 0; i < splits.length; i++) {
+                ret.push(parseInt(splits[i]));
+            }
+            return ret;
+        }
+
+        function sortNumber(a,b) {
+            return a - b;
+        }
+
+        function sparkline(elemId, failed, timeout, hanging, success, domain_min, domain_max) {
+            failed = csvToArray(failed);
+            timeout = csvToArray(timeout);
+            hanging = csvToArray(hanging);
+            success = csvToArray(success);
+            all = failed.concat(timeout).concat(hanging).concat(success);
+            all.sort(sortNumber);
+            x.domain([domain_min, domain_max + 1]);
+            rect_width = x(domain_min + 1) - x(domain_min) - 1;
+            svg = d3.select("#" + elemId).append('svg').attr('width', width).attr('height', height);
+            svg.selectAll("dot")
+                    .data(all)
+                    .enter()
+                    .append("svg:rect")
+                    .attr("x", function(d) { return x(d); })
+                    .attr("y", 3)
+                    .attr("height", height- 6)
+                    .attr("width", rect_width)
+                    .attr("fill", function(d) {
+                        if (success.includes(d)) return "green";
+                        else if (timeout.includes(d)) return "gold";
+                        else if (hanging.includes(d)) return "blue";
+                        else if (failed.includes(d)) return "red";
+                        else return "black";
+                    })
+                    .append('svg:title')
+                    .text(function(d) { return d; });
+        }
+    </script>
 <p>
     <img style="vertical-align:middle; display:inline-block;" height="80px"
          src="https://hbase.apache.org/images/hbase_logo_with_orca_large.png">
@@ -76,11 +126,13 @@
     <a href="#">Go to top</a>
 </span>
 <br/><br/>
+Legend : green: success, red: failed, yellow: timeout, blue: hanging
 <table>
     <tr>
         <th width="400px">Test Name</th>
         <th width="150px">Flakyness</th>
         <th width="200px">Failed/Timeout/Hanging</th>
+        <th width="300px">Trends</th>
         <th>Run Ids</th>
     </tr>
     {% for test in result %}
@@ -104,13 +156,19 @@
         <td align="middle">
             {{ failed|length }} / {{ timeout|length }} / {{ hanging|length }}
         </td>
+        {% set sparkline_id = "sparkline_" ~ test ~ "_" ~ counter  %}
+        <td id="{{ sparkline_id }}" align="middle">
+        </td>
+        <script>sparkline("{{ sparkline_id }}", "{{ failed|join(',') }}", "{{ timeout|join(',') }}",
+                "{{ hanging|join(',') }}", "{{ success|join(',') }}", {{ build_ids[url][0] }},
+                {{ build_ids[url][-1] }});</script>
         <td>
             {% set id = "details_" ~ test ~ "_" ~ url_counter %}
             <button class="show_hide_button" onclick="toggle('{{ id }}')">
                 show/hide</button>
             <br/>
             <div id="{{ id }}"
-                 style="display: none; width:500px; white-space: normal">
+                 style="display: none; width:300px; white-space: normal">
                 {% macro print_run_ids(url, run_ids) -%}
                 {% for i in run_ids %}
                 <a href="{{ url }}/{{ i }}">{{ i }}</a>&nbsp;

http://git-wip-us.apache.org/repos/asf/hbase/blob/c51c36fd/dev-support/report-flakies.py
----------------------------------------------------------------------
diff --git a/dev-support/report-flakies.py b/dev-support/report-flakies.py
index 715f33e..a28c3fb 100755
--- a/dev-support/report-flakies.py
+++ b/dev-support/report-flakies.py
@@ -125,6 +125,9 @@ all_hanging_tests = set()
 # Contains { <url> : { <bad_test> : { 'all': [<build ids>], 'failed': [<build ids>],
 #                                     'timeout': [<build ids>], 'hanging': [<builds ids>] } } }
 url_to_bad_test_results = OrderedDict()
+# Contains { <url> : [run_ids] }
+# Used for common min/max build ids when generating sparklines.
+url_to_build_ids = OrderedDict()
 
 # Iterates over each url, gets test results and prints flaky tests.
 expanded_urls = expand_multi_config_projects(args)
@@ -140,7 +143,7 @@ for url_max_build in expanded_urls:
         logger.info("Analyzing build : %s", url)
     build_id_to_results = {}
     num_builds = 0
-    build_ids = []
+    url_to_build_ids[url] = []
     build_ids_without_tests_run = []
     for build in builds:
         build_id = build["number"]
@@ -154,9 +157,10 @@ for url_max_build in expanded_urls:
         else:
             build_ids_without_tests_run.append(build_id)
         num_builds += 1
-        build_ids.append(build_id)
+        url_to_build_ids[url].append(build_id)
         if num_builds == url_max_build["max_builds"]:
             break
+    url_to_build_ids[url].sort()
 
     # Collect list of bad tests.
     bad_tests = set()
@@ -217,10 +221,10 @@ for url_max_build in expanded_urls:
                 len(test_status['hanging']), test_status['flakyness'])
     else:
         print "No flaky tests founds."
-        if len(build_ids) == len(build_ids_without_tests_run):
+        if len(url_to_build_ids[url]) == len(build_ids_without_tests_run):
             print "None of the analyzed builds have test result."
 
-    print "Builds analyzed: {}".format(build_ids)
+    print "Builds analyzed: {}".format(url_to_build_ids[url])
     print "Builds without any test runs: {}".format(build_ids_without_tests_run)
     print ""
 
@@ -248,4 +252,4 @@ with open(os.path.join(dev_support_dir, "flaky-dashboard-template.html"), "r") a
 with open("dashboard.html", "w") as f:
     datetime = time.strftime("%m/%d/%Y %H:%M:%S")
     f.write(template.render(datetime=datetime, bad_tests_count=len(all_bad_tests),
-                            results=url_to_bad_test_results))
+                            results=url_to_bad_test_results, build_ids=url_to_build_ids))