예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
 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))
예제 #4
0
 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)
예제 #5
0
 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))