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


Python MultiTool.on_send_signal方法代码示例

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


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

示例1: test_MultiTool

# 需要导入模块: from celery.bin.multi import MultiTool [as 别名]
# 或者: from celery.bin.multi.MultiTool import on_send_signal [as 别名]

#.........这里部分代码省略.........
        node1.expander.return_value = 'A'
        node2.expander.return_value = 'B'
        nodes = self.t.cluster_from_argv.return_value = [node1, node2]
        self.assertIs(self.t.expand('%p', '10'), self.t.ok.return_value)
        self.t.cluster_from_argv.assert_called_with(('10',))
        for node in nodes:
            node.expander.assert_called_with('%p')
        self.t.ok.assert_called_with('A\nB')

    def test_note(self):
        self.t.quiet = True
        self.t.note('foo')
        self.t.say.assert_not_called()
        self.t.quiet = False
        self.t.note('foo')
        self.t.say.assert_called_with('foo', newline=True)

    def test_splash(self):
        x = MultiTool()
        x.note = Mock()
        x.nosplash = True
        x.splash()
        x.note.assert_not_called()
        x.nosplash = False
        x.splash()
        x.note.assert_called()

    def test_Cluster(self):
        m = MultiTool()
        c = m.cluster_from_argv(['A', 'B', 'C'])
        self.assertIs(c.env, m.env)
        self.assertEqual(c.cmd, 'celery worker')
        self.assertEqual(c.on_stopping_preamble, m.on_stopping_preamble)
        self.assertEqual(c.on_send_signal, m.on_send_signal)
        self.assertEqual(c.on_still_waiting_for, m.on_still_waiting_for)
        self.assertEqual(
            c.on_still_waiting_progress,
            m.on_still_waiting_progress,
        )
        self.assertEqual(c.on_still_waiting_end, m.on_still_waiting_end)
        self.assertEqual(c.on_node_start, m.on_node_start)
        self.assertEqual(c.on_node_restart, m.on_node_restart)
        self.assertEqual(c.on_node_shutdown_ok, m.on_node_shutdown_ok)
        self.assertEqual(c.on_node_status, m.on_node_status)
        self.assertEqual(c.on_node_signal_dead, m.on_node_signal_dead)
        self.assertEqual(c.on_node_signal, m.on_node_signal)
        self.assertEqual(c.on_node_down, m.on_node_down)
        self.assertEqual(c.on_child_spawn, m.on_child_spawn)
        self.assertEqual(c.on_child_signalled, m.on_child_signalled)
        self.assertEqual(c.on_child_failure, m.on_child_failure)

    def test_on_stopping_preamble(self):
        self.t.on_stopping_preamble([])

    def test_on_send_signal(self):
        self.t.on_send_signal(Mock(), Mock())

    def test_on_still_waiting_for(self):
        self.t.on_still_waiting_for([Mock(), Mock()])

    def test_on_still_waiting_for__empty(self):
        self.t.on_still_waiting_for([])

    def test_on_still_waiting_progress(self):
        self.t.on_still_waiting_progress([])
开发者ID:Changgyujin,项目名称:celery,代码行数:69,代码来源:test_multi.py


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