本文整理汇总了Python中celery.bin.multi.MultiTool.on_stopping_preamble方法的典型用法代码示例。如果您正苦于以下问题:Python MultiTool.on_stopping_preamble方法的具体用法?Python MultiTool.on_stopping_preamble怎么用?Python MultiTool.on_stopping_preamble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.bin.multi.MultiTool
的用法示例。
在下文中一共展示了MultiTool.on_stopping_preamble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_MultiTool
# 需要导入模块: from celery.bin.multi import MultiTool [as 别名]
# 或者: from celery.bin.multi.MultiTool import on_stopping_preamble [as 别名]
#.........这里部分代码省略.........
node2 = Mock(name='n2')
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([])