def test_save_restore_taskset(self): backend = CacheBackend() taskset_id = gen_unique_id() subtask_ids = [gen_unique_id() for i in range(10)] subtasks = map(result.AsyncResult, subtask_ids) res = result.TaskSetResult(taskset_id, subtasks) res.save(backend=backend) saved = result.TaskSetResult.restore(taskset_id, backend=backend) self.assertListEqual(saved.subtasks, subtasks) self.assertEqual(saved.taskset_id, taskset_id)
def unlock_chord(setid, callback, interval=1, propagate=False, max_retries=None, result=None): result = _res.TaskSetResult(setid, map(_res.AsyncResult, result)) j = result.join_native if result.supports_native_join else result.join if result.ready(): subtask(callback).delay(j(propagate=propagate)) else: unlock_chord.retry(countdown=interval, max_retries=max_retries)