[CalendarServer-changes] [14782] twext/trunk/twext/enterprise/jobqueue.py

source_changes at macosforge.org source_changes at macosforge.org
Wed May 13 11:09:46 PDT 2015


Revision: 14782
          http://trac.calendarserver.org//changeset/14782
Author:   cdaboo at apple.com
Date:     2015-05-13 11:09:46 -0700 (Wed, 13 May 2015)
Log Message:
-----------
Allow manual removal of a work item and associated job.

Modified Paths:
--------------
    twext/trunk/twext/enterprise/jobqueue.py

Modified: twext/trunk/twext/enterprise/jobqueue.py
===================================================================
--- twext/trunk/twext/enterprise/jobqueue.py	2015-05-12 21:02:52 UTC (rev 14781)
+++ twext/trunk/twext/enterprise/jobqueue.py	2015-05-13 18:09:46 UTC (rev 14782)
@@ -1134,6 +1134,19 @@
         return succeed(None)
 
 
+    @inlineCallbacks
+    def remove(self):
+        """
+        Remove this L{WorkItem} and the associated L{JobItem}. Typically work is not removed directly, but goes away
+        when processed, but in some cases (e.g., pod-2-pod migration) old work needs to be removed along with the
+        job (which is in a pause state and would otherwise never run).
+        """
+
+        # Delete the job, then self
+        yield JobItem.deletesome(self.transaction, JobItem.jobID == self.jobID)
+        yield self.delete()
+
+
     @classmethod
     @inlineCallbacks
     def reschedule(cls, transaction, seconds, **kwargs):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150513/fdc1c26a/attachment.html>


More information about the calendarserver-changes mailing list