Title: [196459] trunk/Websites/perf.webkit.org
Revision
196459
Author
[email protected]
Date
2016-02-11 17:05:14 -0800 (Thu, 11 Feb 2016)

Log Message

Add a script to process backlogs created while perf dashboard was in the maintenance mode
https://bugs.webkit.org/show_bug.cgi?id=154140

Reviewed by Chris Dumez.

Added a script to process the backlog JSONs created while the perf dashboard was put in the maintenance mode.
It re-submits each JSON file to the perf dashboard using the same server config file used by syncing scripts.

* public/include/report-processor.php:
(TestRunsGenerator::test_value_list_to_values_by_iterations): Fixed a bug in the error message code. It was
referencing an undeclared variable.
* tools/process-maintenance-backlog.py: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (196458 => 196459)


--- trunk/Websites/perf.webkit.org/ChangeLog	2016-02-12 00:59:11 UTC (rev 196458)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2016-02-12 01:05:14 UTC (rev 196459)
@@ -1,5 +1,20 @@
 2016-02-11  Ryosuke Niwa  <[email protected]>
 
+        Add a script to process backlogs created while perf dashboard was in the maintenance mode
+        https://bugs.webkit.org/show_bug.cgi?id=154140
+
+        Reviewed by Chris Dumez.
+
+        Added a script to process the backlog JSONs created while the perf dashboard was put in the maintenance mode.
+        It re-submits each JSON file to the perf dashboard using the same server config file used by syncing scripts.
+
+        * public/include/report-processor.php:
+        (TestRunsGenerator::test_value_list_to_values_by_iterations): Fixed a bug in the error message code. It was
+        referencing an undeclared variable.
+        * tools/process-maintenance-backlog.py: Added.
+
+2016-02-11  Ryosuke Niwa  <[email protected]>
+
         AnalysisResultsViewer never uses this._smallerIsBetter
         https://bugs.webkit.org/show_bug.cgi?id=154134
 

Modified: trunk/Websites/perf.webkit.org/public/include/report-processor.php (196458 => 196459)


--- trunk/Websites/perf.webkit.org/public/include/report-processor.php	2016-02-12 00:59:11 UTC (rev 196458)
+++ trunk/Websites/perf.webkit.org/public/include/report-processor.php	2016-02-12 01:05:14 UTC (rev 196459)
@@ -335,7 +335,7 @@
             if (count($values) != count($group_sizes)) {
                 // FIXME: We should support bootstrapping or just computing the mean in this case.
                 $this->exit_with_error('IterationGroupCountIsInconsistent', array('parent' => $test_metric['test_id'],
-                    'metric' => $test_metric['metric_name'], 'childTest' => $name_and_values['name'],
+                    'metric' => $test_metric['metric_name'], 'childTest' => $test_name,
                     'valuesByIterations' => $values_by_iterations, 'values' => $values));
             }
 
@@ -345,7 +345,7 @@
                     $run_iteration_value = $values[$group][$i];
                     if (!is_numeric($run_iteration_value)) {
                         $this->exit_with_error('NonNumeralIterationValueForAggregation', array('parent' => $test_metric['test_id'],
-                            'metric' => $test_metric['metric_name'], 'childTest' => $name_and_values['name'],
+                            'metric' => $test_metric['metric_name'], 'childTest' => $test_name,
                             'valuesByIterations' => $values_by_iterations, 'values' => $values, 'index' => $i));
                     }
                     array_push($values_by_iterations[$flattened_iteration_index], $run_iteration_value);

Added: trunk/Websites/perf.webkit.org/tools/process-maintenance-backlog.py (0 => 196459)


--- trunk/Websites/perf.webkit.org/tools/process-maintenance-backlog.py	                        (rev 0)
+++ trunk/Websites/perf.webkit.org/tools/process-maintenance-backlog.py	2016-02-12 01:05:14 UTC (rev 196459)
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+
+import argparse
+import json
+import os
+import sys
+import urllib2
+
+from util import load_server_config
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--server-config-json', required=True, help='The path to a JSON file that specifies the perf dashboard.')
+    args = parser.parse_args()
+
+    maintenace_dir = determine_maintenance_dir()
+
+    server_config = load_server_config(args.server_config_json)
+
+    print 'Submitting results in "%s" to "%s"' % (maintenace_dir, server_config['server']['url'])
+
+    for filename in os.listdir(maintenace_dir):
+        path = os.path.join(maintenace_dir, filename)
+        if os.path.isfile(path) and filename.endswith('.json'):
+
+            with open(os.path.join(maintenace_dir, path)) as submitted_json_file:
+                submitted_content = submitted_json_file.read()
+
+            print '%s...' % filename,
+            sys.stdout.flush()
+
+            suffix = '.done'
+            while True:
+                if submit_report(server_config, submitted_content):
+                    break
+                if ask_yes_no_question('Suffix the file with .error and continue?'):
+                    suffix = '.error'
+                    break
+                else:
+                    sys.exit(0)
+
+            os.rename(path, path + suffix)
+
+            print 'Done'
+
+
+def determine_maintenance_dir():
+    root_dir = os.path.join(os.path.dirname(__file__), '../')
+
+    config_json_path = os.path.abspath(os.path.join(root_dir, 'config.json'))
+    with open(config_json_path) as config_json_file:
+        config = json.load(config_json_file)
+
+    dirname = config.get('maintenanceDirectory')
+    if not dirname:
+        sys.exit('maintenanceDirectory is not specified in config.json')
+
+    return os.path.abspath(os.path.join(root_dir, dirname))
+
+
+def ask_yes_no_question(question):
+    while True:
+        action = "" + ' (y/n): ')
+        if action == 'y' or action == 'yes':
+            return True
+        elif action == 'n' or action == 'no':
+            return False
+        else:
+            print 'Please answer by yes or no'
+
+
+def submit_report(server_config, payload):
+    try:
+        request = urllib2.Request(server_config['server']['url'] + '/api/report')
+        request.add_header('Content-Type', 'application/json')
+        request.add_header('Content-Length', len(payload))
+
+        output = urllib2.urlopen(request, payload).read()
+        try:
+            result = json.loads(output)
+        except Exception, error:
+            raise Exception(error, output)
+
+        if result.get('status') != 'OK':
+            raise Exception(result)
+
+        return True
+    except Exception as error:
+        print >> sys.stderr, 'Failed to submit commits: %s' % str(error)
+        return False
+
+
+if __name__ == "__main__":
+    main()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to