Skip to content

Instantly share code, notes, and snippets.

Created July 19, 2010 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/481869 to your computer and use it in GitHub Desktop.
Save anonymous/481869 to your computer and use it in GitHub Desktop.
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