<!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>[173979] trunk/Tools</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/173979">173979</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-09-25 16:16:57 -0700 (Thu, 25 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>EWS only repeats its cycle every two hours
https://bugs.webkit.org/show_bug.cgi?id=137129

Reviewed by Ryosuke Niwa.

* QueueStatusServer/app.yaml: Updated version.

* QueueStatusServer/config/queues.py: Moved timeout from activeworkitems.py to configuration.

* QueueStatusServer/handlers/releaselock.py: Added. Releases the lock without removing
the patch from work items.

* QueueStatusServer/index.yaml: No real change, just let AppEngine have its way with entry order.

* QueueStatusServer/main.py: Added release-lock.

* QueueStatusServer/model/activeworkitems.py:
(ActiveWorkItems.deactivate_expired): Use timeout from configuration.

* QueueStatusServer/model/workitems.py: Added move_to_end. When we unlock a patch,
we don't want it to be immediately picked up again, it's better to give other patches
a chance.

* QueueStatusServer/templates/releaselock.html: Added. Not sure why all commands have
these interactive versions, but OK.

* Scripts/webkitpy/tool/commands/earlywarningsystem.py: (AbstractEarlyWarningSystem.review_patch):
Unlock the patch when a non-final failure occurs (e.g. can't build even without the patch,
or svn is down).

* Scripts/webkitpy/tool/commands/queues.py:
(AbstractReviewQueue.process_work_item): Do not try/catch ScriptError around review_patch.
Style queue never raises these, and EWS already calls _did_fail, before re-throwing,
meaning that these handlers could never do the right thing. We'd either get a duplicate
_did_fail, or try to unlock an already unlocked patch.
(StyleQueue.review_patch): Unlock the patch on transient failure (such as svn failure),
making it eligible for retry immediately.

* Scripts/webkitpy/common/net/statusserver.py:
(StatusServer._post_release_lock):
(StatusServer.release_lock):
Added a call to release-lock.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsQueueStatusServerappyaml">trunk/Tools/QueueStatusServer/app.yaml</a></li>
<li><a href="#trunkToolsQueueStatusServerconfigqueuespy">trunk/Tools/QueueStatusServer/config/queues.py</a></li>
<li><a href="#trunkToolsQueueStatusServerindexyaml">trunk/Tools/QueueStatusServer/index.yaml</a></li>
<li><a href="#trunkToolsQueueStatusServermainpy">trunk/Tools/QueueStatusServer/main.py</a></li>
<li><a href="#trunkToolsQueueStatusServermodelactiveworkitemspy">trunk/Tools/QueueStatusServer/model/activeworkitems.py</a></li>
<li><a href="#trunkToolsQueueStatusServermodelworkitemspy">trunk/Tools/QueueStatusServer/model/workitems.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonnetstatusserverpy">trunk/Tools/Scripts/webkitpy/common/net/statusserver.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsearlywarningsystempy">trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsqueuespy">trunk/Tools/Scripts/webkitpy/tool/commands/queues.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsQueueStatusServerhandlersreleaselockpy">trunk/Tools/QueueStatusServer/handlers/releaselock.py</a></li>
<li><a href="#trunkToolsQueueStatusServertemplatesreleaselockhtml">trunk/Tools/QueueStatusServer/templates/releaselock.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/ChangeLog        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-09-25  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        EWS only repeats its cycle every two hours
+        https://bugs.webkit.org/show_bug.cgi?id=137129
+
+        Reviewed by Ryosuke Niwa.
+
+        * QueueStatusServer/app.yaml: Updated version.
+
+        * QueueStatusServer/config/queues.py: Moved timeout from activeworkitems.py to configuration.
+
+        * QueueStatusServer/handlers/releaselock.py: Added. Releases the lock without removing
+        the patch from work items.
+
+        * QueueStatusServer/index.yaml: No real change, just let AppEngine have its way with entry order.
+
+        * QueueStatusServer/main.py: Added release-lock.
+
+        * QueueStatusServer/model/activeworkitems.py:
+        (ActiveWorkItems.deactivate_expired): Use timeout from configuration.
+
+        * QueueStatusServer/model/workitems.py: Added move_to_end. When we unlock a patch,
+        we don't want it to be immediately picked up again, it's better to give other patches
+        a chance.
+
+        * QueueStatusServer/templates/releaselock.html: Added. Not sure why all commands have
+        these interactive versions, but OK.
+
+        * Scripts/webkitpy/tool/commands/earlywarningsystem.py: (AbstractEarlyWarningSystem.review_patch):
+        Unlock the patch when a non-final failure occurs (e.g. can't build even without the patch,
+        or svn is down).
+
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (AbstractReviewQueue.process_work_item): Do not try/catch ScriptError around review_patch.
+        Style queue never raises these, and EWS already calls _did_fail, before re-throwing,
+        meaning that these handlers could never do the right thing. We'd either get a duplicate
+        _did_fail, or try to unlock an already unlocked patch.
+        (StyleQueue.review_patch): Unlock the patch on transient failure (such as svn failure),
+        making it eligible for retry immediately.
+
+        * Scripts/webkitpy/common/net/statusserver.py:
+        (StatusServer._post_release_lock):
+        (StatusServer.release_lock):
+        Added a call to release-lock.
+
</ins><span class="cx"> 2014-09-25  Roger Fong  &lt;roger_fong@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Windows] Followup to r173972. Don’t set child process to none before reading from stdout.
</span></span></pre></div>
<a id="trunkToolsQueueStatusServerappyaml"></a>
<div class="modfile"><h4>Modified: trunk/Tools/QueueStatusServer/app.yaml (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/app.yaml        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/QueueStatusServer/app.yaml        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> application: webkit-queues
</span><del>-version: 173587 # Bugzilla bug ID of last major change
</del><ins>+version: 173979 # Bugzilla bug ID of last major change
</ins><span class="cx"> runtime: python
</span><span class="cx"> api_version: 1
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsQueueStatusServerconfigqueuespy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/QueueStatusServer/config/queues.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/config/queues.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/QueueStatusServer/config/queues.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+# Copyright (C) 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> # Copyright (C) 2013 Google Inc. All rights reserved.
</span><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -26,6 +27,8 @@
</span><span class="cx"> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><ins>+from datetime import timedelta
+
</ins><span class="cx"> # Eventually the list of queues may be stored in the data store.
</span><span class="cx"> all_queue_names = [
</span><span class="cx">     &quot;commit-queue&quot;,
</span><span class="lines">@@ -36,3 +39,7 @@
</span><span class="cx">     &quot;win-ews&quot;,
</span><span class="cx">     &quot;efl-wk2-ews&quot;,
</span><span class="cx"> ]
</span><ins>+
+# If the patch is still active after this much time, then a bot must have frozen or rebooted,
+# and dropped the patch on the floor. We will ignore the lock in this case, and let another bot pick up.
+work_item_lock_timeout = timedelta(minutes=120)
</ins></span></pre></div>
<a id="trunkToolsQueueStatusServerhandlersreleaselockpy"></a>
<div class="addfile"><h4>Added: trunk/Tools/QueueStatusServer/handlers/releaselock.py (0 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/handlers/releaselock.py                                (rev 0)
+++ trunk/Tools/QueueStatusServer/handlers/releaselock.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+# Copyright (C) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other materials
+# provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+from google.appengine.ext import webapp, db
+from google.appengine.ext.webapp import template
+
+from config.queues import work_item_lock_timeout
+from handlers.updatebase import UpdateBase
+from model.queues import Queue
+
+
+class ReleaseLock(UpdateBase):
+    def get(self):
+        self.response.out.write(template.render(&quot;templates/releaselock.html&quot;, {&quot;timeout&quot;: work_item_lock_timeout}))
+
+    def post(self):
+        queue_name = self.request.get(&quot;queue_name&quot;)
+        # FIXME: This queue lookup should be shared between handlers.
+        queue = Queue.queue_with_name(queue_name)
+        if not queue:
+            self.error(404)
+            return
+
+        attachment_id = self._int_from_request(&quot;attachment_id&quot;)
+        queue.active_work_items().expire_item(attachment_id)
+
+        # ReleaseLock is used when a queue neither succeeded nor failed, so it silently releases the patch.
+        # Let's try other patches before retrying this one, in the interest of fairness, and also because
+        # another patch could be posted to address queue problems.
+        queue.work_items().move_to_end(attachment_id)
</ins><span class="cx">Property changes on: trunk/Tools/QueueStatusServer/handlers/releaselock.py
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkToolsQueueStatusServerindexyaml"></a>
<div class="modfile"><h4>Modified: trunk/Tools/QueueStatusServer/index.yaml (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/index.yaml        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/QueueStatusServer/index.yaml        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -31,6 +31,12 @@
</span><span class="cx"> - kind: QueueStatus
</span><span class="cx">   properties:
</span><span class="cx">   - name: bot_id
</span><ins>+  - name: date
+    direction: desc
+
+- kind: QueueStatus
+  properties:
+  - name: bot_id
</ins><span class="cx">   - name: message
</span><span class="cx">   - name: queue_name
</span><span class="cx">   - name: date
</span><span class="lines">@@ -63,12 +69,6 @@
</span><span class="cx"> 
</span><span class="cx"> - kind: QueueStatus
</span><span class="cx">   properties:
</span><del>-  - name: bot_id
-  - name: date
-    direction: desc
-
-- kind: QueueStatus
-  properties:
</del><span class="cx">   - name: queue_name
</span><span class="cx">   - name: date
</span><span class="cx">     direction: desc
</span></span></pre></div>
<a id="trunkToolsQueueStatusServermainpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/QueueStatusServer/main.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/main.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/QueueStatusServer/main.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> from handlers.queuestatusjson import QueueStatusJSON
</span><span class="cx"> from handlers.recentstatus import QueuesOverview
</span><span class="cx"> from handlers.releasepatch import ReleasePatch
</span><ins>+from handlers.releaselock import ReleaseLock
</ins><span class="cx"> from handlers.showresults import ShowResults
</span><span class="cx"> from handlers.statusbubble import StatusBubble
</span><span class="cx"> from handlers.submittoews import SubmitToEWS
</span><span class="lines">@@ -75,6 +76,7 @@
</span><span class="cx">     (r'/queue-status-json/(.*)', QueueStatusJSON),
</span><span class="cx">     (r'/next-patch/(.*)', NextPatch),
</span><span class="cx">     (r'/release-patch', ReleasePatch),
</span><ins>+    (r'/release-lock', ReleaseLock),
</ins><span class="cx">     ('/update-status', UpdateStatus),
</span><span class="cx">     ('/update-work-items', UpdateWorkItems),
</span><span class="cx">     ('/update-svn-revision', UpdateSVNRevision),
</span></span></pre></div>
<a id="trunkToolsQueueStatusServermodelactiveworkitemspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/QueueStatusServer/model/activeworkitems.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/model/activeworkitems.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/QueueStatusServer/model/activeworkitems.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> from datetime import timedelta, datetime
</span><span class="cx"> import time
</span><span class="cx"> 
</span><ins>+from config.queues import work_item_lock_timeout
</ins><span class="cx"> from model.queuepropertymixin import QueuePropertyMixin
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -81,8 +82,8 @@
</span><span class="cx">     def deactivate_expired(self, now):
</span><span class="cx">         # If the patch is still active after this much time, then a bot must have frozen or rebooted,
</span><span class="cx">         # and dropped the patch on the floor. Let another bot pick it up.
</span><del>-        two_hours_ago = time.mktime((now - timedelta(minutes=120)).timetuple())
-        nonexpired_pairs = [pair for pair in self._item_time_pairs() if pair[1] &gt; two_hours_ago]
</del><ins>+        cutoff_time = time.mktime((now - work_item_lock_timeout).timetuple())
+        nonexpired_pairs = [pair for pair in self._item_time_pairs() if pair[1] &gt; cutoff_time]
</ins><span class="cx">         self._set_item_time_pairs(nonexpired_pairs)
</span><span class="cx"> 
</span><span class="cx">     def next_item(self, work_item_ids, now):
</span></span></pre></div>
<a id="trunkToolsQueueStatusServermodelworkitemspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/QueueStatusServer/model/workitems.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/model/workitems.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/QueueStatusServer/model/workitems.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -75,3 +75,15 @@
</span><span class="cx">     # Because this uses .key() self.is_saved() must be True or this will throw NotSavedError.
</span><span class="cx">     def remove_work_item(self, attachment_id):
</span><span class="cx">         db.run_in_transaction(self._unguarded_remove, self.key(), attachment_id)
</span><ins>+
+    @staticmethod
+    def _unguarded_move_to_end(key, attachment_id):
+        work_items = db.get(key)
+        if attachment_id in work_items.item_ids:
+            # We should never have more than one entry for a work item, so we only need remove the first.
+            work_items.item_ids.remove(attachment_id)
+            work_items.item_ids.append(attachment_id)
+        work_items.put()
+
+    def move_to_end(self, attachment_id):
+        db.run_in_transaction(self._unguarded_move_to_end, self.key(), attachment_id)
</ins></span></pre></div>
<a id="trunkToolsQueueStatusServertemplatesreleaselockhtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/QueueStatusServer/templates/releaselock.html (0 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/QueueStatusServer/templates/releaselock.html                                (rev 0)
+++ trunk/Tools/QueueStatusServer/templates/releaselock.html        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+&lt;form name=&quot;release_lock&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;
+&lt;p&gt;Release queue lock.&lt;/p&gt;
+&lt;p&gt;Only use this when a patch is locked erroneously, and there is no bot processing it.
+Patches are also unlocked automatically after a short timeout (currently set to {{ timeout }}), so this is rarely necessary.&lt;/p&gt;
+Patch to unlock: &lt;input name=&quot;attachment_id&quot; placeholder=&quot;patch id in Bugzilla&quot;&gt; from &lt;input name=&quot;queue_name&quot; placeholder=&quot;queue name&quot;&gt;&lt;input type=&quot;submit&quot; value=&quot;Release lock to re-run&quot;&gt;&lt;/div&gt;
+&lt;/form&gt;
</ins><span class="cx">Property changes on: trunk/Tools/QueueStatusServer/templates/releaselock.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkToolsScriptswebkitpycommonnetstatusserverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/net/statusserver.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/net/statusserver.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/Scripts/webkitpy/common/net/statusserver.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -137,6 +137,18 @@
</span><span class="cx">         _log.info(&quot;Releasing work item %s from %s&quot; % (patch.id(), queue_name))
</span><span class="cx">         return NetworkTransaction(convert_404_to_None=True).run(lambda: self._post_release_work_item(queue_name, patch))
</span><span class="cx"> 
</span><ins>+    def _post_release_lock(self, queue_name, patch):
+        release_lock_url = &quot;%s/release-lock&quot; % (self.url)
+        self._browser.open(release_lock_url)
+        self._browser.select_form(name=&quot;release_lock&quot;)
+        self._browser[&quot;queue_name&quot;] = queue_name
+        self._browser[&quot;attachment_id&quot;] = unicode(patch.id())
+        self._browser.submit()
+
+    def release_lock(self, queue_name, patch):
+        _log.info(&quot;Releasing lock for work item %s from %s&quot; % (patch.id(), queue_name))
+        return NetworkTransaction(convert_404_to_None=True).run(lambda: self._post_release_lock(queue_name, patch))
+
</ins><span class="cx">     def update_work_items(self, queue_name, work_items):
</span><span class="cx">         _log.debug(&quot;Recording work items: %s for %s&quot; % (work_items, queue_name))
</span><span class="cx">         return NetworkTransaction().run(lambda: self._post_work_items_to_server(queue_name, work_items))
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsearlywarningsystempy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -85,7 +85,11 @@
</span><span class="cx">             self._did_error(patch, &quot;%s did not process patch.&quot; % self.name)
</span><span class="cx">             return False
</span><span class="cx">         try:
</span><del>-            return task.run()
</del><ins>+            succeeded = task.run()
+            if not succeeded:
+                # Caller unlocks when review_patch returns True, so we only need to unlock on transient failure.
+                self._unlock_patch(patch)
+            return succeeded
</ins><span class="cx">         except UnableToApplyPatch, e:
</span><span class="cx">             self._did_error(patch, &quot;%s unable to apply patch.&quot; % self.name)
</span><span class="cx">             return False
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsqueuespy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues.py (173978 => 173979)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/queues.py        2014-09-25 21:59:13 UTC (rev 173978)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues.py        2014-09-25 23:16:57 UTC (rev 173979)
</span><span class="lines">@@ -248,6 +248,9 @@
</span><span class="cx">         self._update_status(message, patch)
</span><span class="cx">         self._release_work_item(patch)
</span><span class="cx"> 
</span><ins>+    def _unlock_patch(self, patch):
+        self._tool.status_server.release_lock(self.name, patch)
+
</ins><span class="cx">     def work_item_log_path(self, patch):
</span><span class="cx">         return os.path.join(self._log_directory(), &quot;%s.log&quot; % patch.bug_id())
</span><span class="cx"> 
</span><span class="lines">@@ -425,19 +428,10 @@
</span><span class="cx">         return self._next_patch()
</span><span class="cx"> 
</span><span class="cx">     def process_work_item(self, patch):
</span><del>-        try:
-            if not self.review_patch(patch):
-                return False
</del><ins>+        passed = self.review_patch(patch)
+        if passed:
</ins><span class="cx">             self._did_pass(patch)
</span><del>-            return True
-        except ScriptError, e:
-            if e.exit_code != QueueEngine.handled_error_code:
-                self._did_fail(patch)
-            else:
-                # The subprocess handled the error, but won't have released the patch, so we do.
-                # FIXME: We need to simplify the rules by which _release_work_item is called.
-                self._release_work_item(patch)
-            raise e
</del><ins>+        return passed
</ins><span class="cx"> 
</span><span class="cx">     def handle_unexpected_error(self, patch, message):
</span><span class="cx">         _log.error(message)
</span><span class="lines">@@ -461,7 +455,11 @@
</span><span class="cx">             self._did_error(patch, &quot;%s did not process patch.&quot; % self.name)
</span><span class="cx">             return False
</span><span class="cx">         try:
</span><del>-            return task.run()
</del><ins>+            style_check_succeeded = task.run()
+            if not style_check_succeeded:
+                # Caller unlocks when review_patch returns True, so we only need to unlock on transient failure.
+                self._unlock_patch(patch)
+            return style_check_succeeded
</ins><span class="cx">         except UnableToApplyPatch, e:
</span><span class="cx">             self._did_error(patch, &quot;%s unable to apply patch.&quot; % self.name)
</span><span class="cx">             return False
</span></span></pre>
</div>
</div>

</body>
</html>