except NamingError, x: print >> sys.stderr, x self.log.critical(task.id + ' cannot be removed (task not found)') return except Exception, x: print >> sys.stderr, x self.log.critical(task.id + ' cannot be removed (unknown error)') return task.prepare_for_death() # remove task from its queue queue = self.myq[task.name] self.queues[queue].remove(task) msg = "task proxy removed" if reason: msg += " (" + reason + ")" task.log('DEBUG', msg) del task def get_tasks(self): """Return a list of all task proxies""" tasks = [] for queue in self.queues: tasks += self.queues[queue] #tasks.sort() # sorting any use here? return tasks def id_exists(self, id): """Check if a task with the given ID is in the pool""" for queue in self.queues: for task in self.queues[queue]: if task.id == id:
except NamingError, x: print >> sys.stderr, x self.log.critical( task.id + ' cannot be removed (task not found)' ) return except Exception, x: print >> sys.stderr, x self.log.critical( task.id + ' cannot be removed (unknown error)' ) return task.prepare_for_death() # remove task from its queue queue = self.myq[task.name] self.queues[queue].remove( task ) msg = "task proxy removed" if reason: msg += " (" + reason + ")" task.log( 'DEBUG', msg ) del task def get_tasks( self ): """Return a list of all task proxies""" tasks = [] for queue in self.queues: tasks += self.queues[queue] #tasks.sort() # sorting any use here? return tasks def id_exists( self, id ): """Check if a task with the given ID is in the pool""" for queue in self.queues: for task in self.queues[queue]: if task.id == id:
try: self.pyro.disconnect( task.message_queue ) except NamingError, x: # Attempted removal of a task that does not exist. print >> sys.stderr, x self.log.critical( task.id + ' CANNOT BE REMOVED (no such task)' ) return except Exception, x: print >> sys.stderr, x self.log.critical( task.id + ' CANNOT BE REMOVED (unknown error)' ) return task.prepare_for_death() # remove task from its queue queue = self.myq[task.name] self.queues[queue].remove( task ) task.log( 'DEBUG', "task proxy removed (" + reason + ")" ) del task def get_tasks( self ): tasks = [] for queue in self.queues: tasks += self.queues[queue] #tasks.sort() # sorting any use here? return tasks def process( self ): readytogo = [] for queue in self.queues: n_active = 0 n_limit = self.qconfig[queue]['limit'] for itask in self.queues[queue]: