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


Python MultiTool.on_node_shutdown_ok方法代码示例

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


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

示例1: test_MultiTool

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

#.........这里部分代码省略.........

    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([])

    def test_on_still_waiting_end(self):
        self.t.on_still_waiting_end()

    def test_on_node_signal_dead(self):
        self.t.on_node_signal_dead(Mock())

    def test_on_node_start(self):
        self.t.on_node_start(Mock())

    def test_on_node_restart(self):
        self.t.on_node_restart(Mock())

    def test_on_node_down(self):
        self.t.on_node_down(Mock())

    def test_on_node_shutdown_ok(self):
        self.t.on_node_shutdown_ok(Mock())

    def test_on_node_status__FAIL(self):
        self.t.on_node_status(Mock(), 1)
        self.t.say.assert_called_with(self.t.FAILED, newline=True)

    def test_on_node_status__OK(self):
        self.t.on_node_status(Mock(), 0)
        self.t.say.assert_called_with(self.t.OK, newline=True)

    def test_on_node_signal(self):
        self.t.on_node_signal(Mock(), Mock())

    def test_on_child_spawn(self):
        self.t.on_child_spawn(Mock(), Mock(), Mock())

    def test_on_child_signalled(self):
        self.t.on_child_signalled(Mock(), Mock())

    def test_on_child_failure(self):
        self.t.on_child_failure(Mock(), Mock())

    def test_constant_strings(self):
        self.assertTrue(self.t.OK)
        self.assertTrue(self.t.DOWN)
        self.assertTrue(self.t.FAILED)
开发者ID:Changgyujin,项目名称:celery,代码行数:104,代码来源:test_multi.py


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