Created
July 19, 2010 19:34
-
-
Save anonymous/481869 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove(self, uid = None): | |
"""Remove an element with UID = uid from the queue.""" | |
if (uid is None): | |
raise qManagerException("remove: Provide a UID for removal.") | |
if (not self.lockFlag): | |
for elem in self: | |
Log.debug("found UID %s" % elem['UID']) | |
if (elem['UID'] == uid): | |
try: | |
self.qLock.acquire() | |
self.remove(elem) | |
self.qLock.release() | |
self._publishQueue() | |
return "SUCCESS" | |
except Exception, msg: | |
Log.error("qManager: remove: Exception caught: %s" % | |
msg) | |
raise | |
rString = ("remove: UID %s is not in the queue." % str(uid)) | |
Log.error('qManager: %s' % rString) | |
raise qManagerException(rString) | |
else: | |
Log.error('qManager: remove: Queue is locked.') | |
raise qManagerException("Queue is locked.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment