revoked tasks do not show in worker tasks
@@ -377,8 +377,10 @@ class WorkController(configurated):
try:
req.execute_using_pool(self.pool)
except TaskRevokedError:
- if self.semaphore: # (Issue #877)
- self.semaphore.release()
+ try:
+ self._quick_release() # Issue 877
+ except AttributeError:
+ pass
except Exception, exc:
logger.critical('Internal error: %r\n%s',
exc, traceback.format_exc(), exc_info=True)
@@ -40,7 +40,7 @@ def revoke(panel, task_id, terminate=False, signal=None, **kwargs):
action = 'revoked'
if terminate:
signum = _signals.signum(signal or 'TERM')
- for request in state.active_requests:
+ for request in state.reserved_requests:
if request.id == task_id:
action = 'terminated (%s)' % (signum, )
request.terminate(panel.consumer.pool, signal=signum)
@@ -246,6 +246,7 @@ class Request(object):
self._terminate_on_ack = pool, signal
def _announce_revoked(self, reason, terminated, signum, expired):
+ task_ready(self)
self.send_event('task-revoked',
terminated=terminated, signum=signum, expired=expired)
if self.store_errors: