当前位置: 首页>>代码示例>>Python>>正文


Python CacheBackend.apply_chord方法代码示例

本文整理汇总了Python中celery.backends.cache.CacheBackend.apply_chord方法的典型用法代码示例。如果您正苦于以下问题:Python CacheBackend.apply_chord方法的具体用法?Python CacheBackend.apply_chord怎么用?Python CacheBackend.apply_chord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在celery.backends.cache.CacheBackend的用法示例。


在下文中一共展示了CacheBackend.apply_chord方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_on_chord_part_return

# 需要导入模块: from celery.backends.cache import CacheBackend [as 别名]
# 或者: from celery.backends.cache.CacheBackend import apply_chord [as 别名]
    def test_on_chord_part_return(self, restore):
        tb = CacheBackend(backend='memory://', app=self.app)

        deps = Mock()
        deps.__len__ = Mock()
        deps.__len__.return_value = 2
        restore.return_value = deps
        task = Mock()
        task.name = 'foobarbaz'
        self.app.tasks['foobarbaz'] = task
        task.request.chord = signature(task)

        result = self.app.GroupResult(
            uuid(),
            [self.app.AsyncResult(uuid()) for _ in range(3)],
        )
        task.request.group = result.id
        tb.apply_chord(result, None)

        deps.join_native.assert_not_called()
        tb.on_chord_part_return(task.request, 'SUCCESS', 10)
        deps.join_native.assert_not_called()

        tb.on_chord_part_return(task.request, 'SUCCESS', 10)
        deps.join_native.assert_called_with(propagate=True, timeout=3.0)
        deps.delete.assert_called_with()
开发者ID:Scalr,项目名称:celery,代码行数:28,代码来源:test_cache.py

示例2: test_apply_chord

# 需要导入模块: from celery.backends.cache import CacheBackend [as 别名]
# 或者: from celery.backends.cache.CacheBackend import apply_chord [as 别名]
 def test_apply_chord(self):
     tb = CacheBackend(backend='memory://', app=self.app)
     result = self.app.GroupResult(
         uuid(),
         [self.app.AsyncResult(uuid()) for _ in range(3)],
     )
     tb.apply_chord(result, None)
     assert self.app.GroupResult.restore(result.id, backend=tb) == result
开发者ID:Scalr,项目名称:celery,代码行数:10,代码来源:test_cache.py

示例3: test_on_chord_part_return

# 需要导入模块: from celery.backends.cache import CacheBackend [as 别名]
# 或者: from celery.backends.cache.CacheBackend import apply_chord [as 别名]
    def test_on_chord_part_return(self, restore):
        tb = CacheBackend(backend='memory://', app=self.app)

        deps = Mock()
        deps.__len__ = Mock()
        deps.__len__.return_value = 2
        restore.return_value = deps
        task = Mock()
        task.name = 'foobarbaz'
        self.app.tasks['foobarbaz'] = task
        task.request.chord = signature(task)

        gid, res = uuid(), [self.app.AsyncResult(uuid()) for _ in range(3)]
        task.request.group = gid
        tb.apply_chord(group(app=self.app), (), gid, {}, result=res)

        self.assertFalse(deps.join_native.called)
        tb.on_chord_part_return(task)
        self.assertFalse(deps.join_native.called)

        tb.on_chord_part_return(task)
        deps.join_native.assert_called_with(propagate=True)
        deps.delete.assert_called_with()
开发者ID:FlavioFalcao,项目名称:celery,代码行数:25,代码来源:test_cache.py

示例4: test_apply_chord

# 需要导入模块: from celery.backends.cache import CacheBackend [as 别名]
# 或者: from celery.backends.cache.CacheBackend import apply_chord [as 别名]
 def test_apply_chord(self):
     tb = CacheBackend(backend='memory://', app=self.app)
     gid, res = uuid(), [self.app.AsyncResult(uuid()) for _ in range(3)]
     tb.apply_chord(group(app=self.app), (), gid, {}, result=res)
开发者ID:JohnSpeno,项目名称:celery,代码行数:6,代码来源:test_cache.py


注:本文中的celery.backends.cache.CacheBackend.apply_chord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。