<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185539] trunk/Websites/perf.webkit.org</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185539">185539</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2015-06-13 12:28:38 -0700 (Sat, 13 Jun 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add a script to post new OS X builds to perf dashboard
https://bugs.webkit.org/show_bug.cgi?id=145955
Reviewed by Darin Adler.
Added a new script pull-osx.py and relaxed the restrictions on commits accepted by the dashboard API.
* public/api/report-commits.php:
(main): Allow more characters than [A-Za-z0-9] in revision. e.g. "10.10.3 14D136".
Also allow commits without the author, commit time, and commit message as OS versions do not have those.
* tools/pull-osx.py: Added.
(main): Fetch the list of builds from a website and submit them per submissionSize with submissionInterval.
Once all builds have been submitted, wait for a long time as specified by fetchInterval.
(setup_auth): Sets up basic or digest auth to access the dashboard.
(fetch_available_builds): Fetches and parses the XML document from an internal website.
(textContent): A helper function to get the text content out of a XML node.
(submit_commits): Submits commits to the perf dashboard.
* tools/pull-svn.py:
(fetch_commit):
* tools/util.py: Extracted submit_commits and text_content from pull-svn.py to be reused in pull-osx.py.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicapireportcommitsphp">trunk/Websites/perf.webkit.org/public/api/report-commits.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgtoolspullsvnpy">trunk/Websites/perf.webkit.org/tools/pull-svn.py</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgtoolspullosxpy">trunk/Websites/perf.webkit.org/tools/pull-osx.py</a></li>
<li><a href="#trunkWebsitesperfwebkitorgtoolsutilpy">trunk/Websites/perf.webkit.org/tools/util.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (185538 => 185539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2015-06-13 15:25:20 UTC (rev 185538)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2015-06-13 19:28:38 UTC (rev 185539)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2015-06-13 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><ins>+ Add a script to post new OS X builds to perf dashboard
+ https://bugs.webkit.org/show_bug.cgi?id=145955
+
+ Reviewed by Darin Adler.
+
+ Added a new script pull-osx.py and relaxed the restrictions on commits accepted by the dashboard API.
+
+ * public/api/report-commits.php:
+ (main): Allow more characters than [A-Za-z0-9] in revision. e.g. "10.10.3 14D136".
+ Also allow commits without the author, commit time, and commit message as OS versions do not have those.
+
+ * tools/pull-osx.py: Added.
+ (main): Fetch the list of builds from a website and submit them per submissionSize with submissionInterval.
+ Once all builds have been submitted, wait for a long time as specified by fetchInterval.
+ (setup_auth): Sets up basic or digest auth to access the dashboard.
+ (fetch_available_builds): Fetches and parses the XML document from an internal website.
+ (textContent): A helper function to get the text content out of a XML node.
+ (submit_commits): Submits commits to the perf dashboard.
+
+ * tools/pull-svn.py:
+ (fetch_commit):
+
+ * tools/util.py: Extracted submit_commits and text_content from pull-svn.py to be reused in pull-osx.py.
+
+2015-06-13 Ryosuke Niwa <rniwa@webkit.org>
+
</ins><span class="cx"> Perf dashboard's v2 UI shouldn't hide auto-detected outliers
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=145940
</span><span class="cx">
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicapireportcommitsphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/api/report-commits.php (185538 => 185539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/api/report-commits.php        2015-06-13 15:25:20 UTC (rev 185538)
+++ trunk/Websites/perf.webkit.org/public/api/report-commits.php        2015-06-13 19:28:38 UTC (rev 185539)
</span><span class="lines">@@ -18,12 +18,9 @@
</span><span class="cx"> exit_with_error('MissingRepositoryName', array('commit' => $commit_info));
</span><span class="cx"> if (!array_key_exists('revision', $commit_info))
</span><span class="cx"> exit_with_error('MissingRevision', array('commit' => $commit_info));
</span><del>- if (!ctype_alnum($commit_info['revision']))
- exit_with_error('InvalidRevision', array('commit' => $commit_info));
- if (!array_key_exists('time', $commit_info))
- exit_with_error('MissingTimestamp', array('commit' => $commit_info));
- if (!array_key_exists('author', $commit_info) || !is_array($commit_info['author']))
- exit_with_error('MissingAuthorOrInvalidFormat', array('commit' => $commit_info));
</del><ins>+ require_format('Revision', $commit_info['revision'], '/^[A-Za-z0-9 \.]+$/');
+ if (array_key_exists('author', $commit_info) && !is_array($commit_info['author']))
+ exit_with_error('InvalidAuthorFormat', array('commit' => $commit_info));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $db->begin_transaction();
</span><span class="lines">@@ -34,16 +31,20 @@
</span><span class="cx"> exit_with_error('FailedToInsertRepository', array('commit' => $commit_info));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $account = array_get($commit_info['author'], 'account');
- $committer_query = array('repository' => $repository_id, 'account' => $account);
- $committer_data = $committer_query;
- $name = array_get($commit_info['author'], 'name');
- if ($name)
- $committer_data['name'] = $name;
- $committer_id = $db->update_or_insert_row('committers', 'committer', $committer_query, $committer_data);
- if (!$committer_id) {
- $db->rollback_transaction();
- exit_with_error('FailedToInsertCommitter', array('committer' => $committer_data));
</del><ins>+ $author = array_get($commit_info, 'author');
+ $committer_id = NULL;
+ if ($author) {
+ $account = array_get($author, 'account');
+ $committer_query = array('repository' => $repository_id, 'account' => $account);
+ $committer_data = $committer_query;
+ $name = array_get($author, 'name');
+ if ($name)
+ $committer_data['name'] = $name;
+ $committer_id = $db->update_or_insert_row('committers', 'committer', $committer_query, $committer_data);
+ if (!$committer_id) {
+ $db->rollback_transaction();
+ exit_with_error('FailedToInsertCommitter', array('committer' => $committer_data));
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $parent_revision = array_get($commit_info, 'parent');
</span><span class="lines">@@ -61,9 +62,9 @@
</span><span class="cx"> 'repository' => $repository_id,
</span><span class="cx"> 'revision' => $commit_info['revision'],
</span><span class="cx"> 'parent' => $parent_id,
</span><del>- 'time' => $commit_info['time'],
</del><ins>+ 'time' => array_get($commit_info, 'time'),
</ins><span class="cx"> 'committer' => $committer_id,
</span><del>- 'message' => $commit_info['message'],
</del><ins>+ 'message' => array_get($commit_info, 'message'),
</ins><span class="cx"> 'reported' => true,
</span><span class="cx"> );
</span><span class="cx"> $db->update_or_insert_row('commits', 'commit', array('repository' => $repository_id, 'revision' => $data['revision']), $data);
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgtoolspullosxpy"></a>
<div class="addfile"><h4>Added: trunk/Websites/perf.webkit.org/tools/pull-osx.py (0 => 185539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/tools/pull-osx.py         (rev 0)
+++ trunk/Websites/perf.webkit.org/tools/pull-osx.py        2015-06-13 19:28:38 UTC (rev 185539)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+#!/usr/bin/python
+
+import argparse
+import json
+import sys
+import time
+import urllib
+import urllib2
+
+from xml.dom.minidom import parseString as parseXmlString
+from util import submit_commits
+from util import text_content
+
+
+HTTP_AUTH_HANDLERS = {
+ 'basic': urllib2.HTTPBasicAuthHandler,
+ 'digest': urllib2.HTTPDigestAuthHandler,
+}
+
+
+def main(argv):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--config', required=True, help='Path to a config JSON file')
+ args = parser.parse_args()
+
+ with open(args.config) as config_file:
+ config = json.load(config_file)
+
+ setup_auth(config['server'])
+
+ url = config['buildSourceURL']
+ submission_size = config['submissionSize']
+ reported_revisions = set()
+
+ while True:
+ print "Fetching available builds from %s" % url
+ available_builds = fetch_available_builds(url, config['trainVersionMap'])
+ available_builds = filter(lambda commit: commit['revision'] not in reported_revisions, available_builds)
+ print "%d builds available" % len(available_builds)
+
+ while True:
+ commits_to_submit = available_builds[:submission_size]
+ revisions_to_report = map(lambda commit: commit['revision'], commits_to_submit)
+ print "Submitting builds (%d remaining):" % len(available_builds), json.dumps(revisions_to_report)
+ available_builds = available_builds[submission_size:]
+
+ submit_commits(commits_to_submit, config['server']['url'], config['slave']['name'], config['slave']['password'])
+ reported_revisions |= set(revisions_to_report)
+
+ time.sleep(config['submissionInterval'])
+
+ time.sleep(config['fetchInterval'])
+
+
+def setup_auth(server):
+ auth = server.get('auth')
+ if not auth:
+ return
+
+ password_manager = urllib2.HTTPPasswordMgr()
+ password_manager.add_password(realm=auth['realm'], uri=server['url'], user=auth['username'], passwd=auth['password'])
+ auth_handler = HTTP_AUTH_HANDLERS[auth['type']](password_manager)
+ urllib2.install_opener(urllib2.build_opener(auth_handler))
+
+
+def fetch_available_builds(url, train_version_map):
+ output = urllib2.urlopen(url).read()
+ try:
+ xml = parseXmlString(output)
+ except Exception, error:
+ raise Exception(error, output)
+ available_builds = []
+ for image in xml.getElementsByTagName('baseASR'):
+ id = text_content(image.getElementsByTagName('id')[0])
+ train = text_content(image.getElementsByTagName('train')[0])
+ build = text_content(image.getElementsByTagName('build')[0])
+ if train not in train_version_map:
+ continue
+ available_builds.append({
+ 'repository': 'OS X',
+ 'revision': train_version_map[train] + ' ' + build})
+
+ return available_builds
+
+
+if __name__ == "__main__":
+ main(sys.argv)
</ins><span class="cx">Property changes on: trunk/Websites/perf.webkit.org/tools/pull-osx.py
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkWebsitesperfwebkitorgtoolspullsvnpy"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/tools/pull-svn.py (185538 => 185539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/tools/pull-svn.py        2015-06-13 15:25:20 UTC (rev 185538)
+++ trunk/Websites/perf.webkit.org/tools/pull-svn.py        2015-06-13 19:28:38 UTC (rev 185539)
</span><span class="lines">@@ -8,6 +8,8 @@
</span><span class="cx"> import urllib2
</span><span class="cx">
</span><span class="cx"> from xml.dom.minidom import parseString as parseXmlString
</span><ins>+from util import submit_commits
+from util import text_content
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def main(argv):
</span><span class="lines">@@ -103,9 +105,9 @@
</span><span class="cx"> return None
</span><span class="cx"> raise error
</span><span class="cx"> xml = parseXmlString(output)
</span><del>- time = textContent(xml.getElementsByTagName("date")[0])
- author_account = textContent(xml.getElementsByTagName("author")[0])
- message = textContent(xml.getElementsByTagName("msg")[0])
</del><ins>+ time = text_content(xml.getElementsByTagName("date")[0])
+ author_account = text_content(xml.getElementsByTagName("author")[0])
+ message = text_content(xml.getElementsByTagName("msg")[0])
</ins><span class="cx"> return {
</span><span class="cx"> 'repository': repository_name,
</span><span class="cx"> 'revision': revision,
</span><span class="lines">@@ -115,16 +117,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-def textContent(element):
- text = ''
- for child in element.childNodes:
- if child.nodeType == child.TEXT_NODE:
- text += child.data
- else:
- text += textContent(child)
- return text
-
-
</del><span class="cx"> name_account_compound_regex = re.compile(r'^\s*(?P<name>(\".+\"|[^<]+?))\s*\<(?P<account>.+)\>\s*$')
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -136,28 +128,5 @@
</span><span class="cx"> return output.strip()
</span><span class="cx">
</span><span class="cx">
</span><del>-def submit_commits(commits, dashboard_url, slave_name, slave_password):
- try:
- payload = json.dumps({
- 'slaveName': slave_name,
- 'slavePassword': slave_password,
- 'commits': commits,
- })
- request = urllib2.Request(dashboard_url + '/api/report-commits')
- 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)
- except Exception as error:
- sys.exit('Failed to submit commits: %s' % str(error))
-
-
</del><span class="cx"> if __name__ == "__main__":
</span><span class="cx"> main(sys.argv)
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgtoolsutilpy"></a>
<div class="addfile"><h4>Added: trunk/Websites/perf.webkit.org/tools/util.py (0 => 185539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/tools/util.py         (rev 0)
+++ trunk/Websites/perf.webkit.org/tools/util.py        2015-06-13 19:28:38 UTC (rev 185539)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+import json
+import sys
+import urllib2
+
+
+def submit_commits(commits, dashboard_url, slave_name, slave_password):
+ try:
+ payload = json.dumps({
+ 'slaveName': slave_name,
+ 'slavePassword': slave_password,
+ 'commits': commits,
+ })
+ request = urllib2.Request(dashboard_url + '/api/report-commits')
+ 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)
+ except Exception as error:
+ sys.exit('Failed to submit commits: %s' % str(error))
+
+
+def text_content(element):
+ text = ''
+ for child in element.childNodes:
+ if child.nodeType == child.TEXT_NODE:
+ text += child.data
+ else:
+ text += text_content(child)
+ return text
</ins></span></pre>
</div>
</div>
</body>
</html>