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


Python CacheBackend.on_chord_apply方法代码示例

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


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

示例1: test_on_chord_part_return

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

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

            gid, res = uuid(), [AsyncResult(uuid()) for _ in range(3)]
            task.request.group = gid
            tb.on_chord_apply(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()

        finally:
            self.app.tasks.pop('foobarbaz')
开发者ID:Birdbird,项目名称:celery,代码行数:29,代码来源:test_cache.py

示例2: test_on_chord_part_return

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

        deps = Mock()
        deps.total = 2
        setresult.restore.return_value = deps
        task = Mock()
        task.name = "foobarbaz"
        try:
            current_app.tasks["foobarbaz"] = task
            task.request.chord = subtask(task)
            task.request.taskset = "setid"

            tb.on_chord_apply(task.request.taskset, [])

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

            tb.on_chord_part_return(task)
            deps.join.assert_called_with(propagate=False)
            deps.delete.assert_called_with()

        finally:
            current_app.tasks.pop("foobarbaz")
开发者ID:sunliwen,项目名称:celery,代码行数:27,代码来源:test_cache.py

示例3: test_on_chord_part_return

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

        deps = Mock()
        deps.__len__ = Mock()
        deps.__len__.return_value = 2
        setresult.restore.return_value = deps
        task = Mock()
        task.name = 'foobarbaz'
        try:
            current_app.tasks['foobarbaz'] = task
            task.request.chord = subtask(task)
            task.request.group = 'group_id'

            tb.on_chord_apply(task.request.group, [])

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

            tb.on_chord_part_return(task)
            deps.join.assert_called_with(propagate=False)
            deps.delete.assert_called_with()

        finally:
            current_app.tasks.pop('foobarbaz')
开发者ID:EnTeQuAk,项目名称:celery,代码行数:28,代码来源:test_cache.py

示例4: test_on_chord_part_return

# 需要导入模块: from celery.backends.cache import CacheBackend [as 别名]
# 或者: from celery.backends.cache.CacheBackend import on_chord_apply [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.on_chord_apply(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:haridas,项目名称:celery,代码行数:25,代码来源:test_cache.py

示例5: test_on_chord_apply

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

示例6: test_on_chord_apply

# 需要导入模块: from celery.backends.cache import CacheBackend [as 别名]
# 或者: from celery.backends.cache.CacheBackend import on_chord_apply [as 别名]
 def test_on_chord_apply(self):
     tb = CacheBackend(backend="memory://")
     tb.on_chord_apply("setid", [])
开发者ID:sunliwen,项目名称:celery,代码行数:5,代码来源:test_cache.py


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