def move_tasks(kz): base_path = config['cache']['manager']['lock_path_prefix'] for path in kz.get_children(base_path + '/entries'): item = kz.get('{}/entries/{}'.format(base_path, path))[0] if not item: continue task = msgpack.unpackb(item) q = LockingQueue(kz, base_path, task['group']) q.put(item)
def move_tasks(kz): base_path = config['cache']['manager']['lock_path_prefix'] for path in kz.get_children(base_path + '/entries'): item = kz.get('{}/entries/{}'.format( base_path, path))[0] if not item: continue task = msgpack.unpackb(item) q = LockingQueue(kz, base_path, task['group']) q.put(item)
def put_task(self, task): group_id = task['group'] q = LockingQueue(self.client, self.lock_path_prefix, group_id) return q.put(self._serialize(task))
def list(self): for group_id in self.client.retry(self.client.get_children, self.lock_path_prefix): for item in LockingQueue(self.client, self.lock_path_prefix, group_id).list(): yield self._unserialize(item)