def count_waiting_jobs(cls, name): """ Return the number of all jobs waiting in queues with the given name """ collection = cls.collection(name=name).sort(by='-priority') return sum([col.waiting.llen() for col in collection.instances()])
def get_keys(cls, name): """ Return a list of all queue keys, to use with blpop """ collection = cls.collection(name=name).sort(by='-priority') return [col.waiting.key for col in collection.instances()]