本文整理汇总了Python中celery.events.state.Task.event方法的典型用法代码示例。如果您正苦于以下问题:Python Task.event方法的具体用法?Python Task.event怎么用?Python Task.event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.events.state.Task
的用法示例。
在下文中一共展示了Task.event方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ready
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_ready(self):
task = Task(uuid='abcdefg',
name='tasks.add')
task.event('received', time(), time())
self.assertFalse(task.ready)
task.event('succeeded', time(), time())
self.assertTrue(task.ready)
示例2: test_ready
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_ready(self):
task = Task(uuid='abcdefg',
name='tasks.add')
task.event('received', time(), time())
assert not task.ready
task.event('succeeded', time(), time())
assert task.ready
示例3: test_merge
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_merge(self):
task = Task()
task.event("failed", time(), time())
task.event("started", time(), time())
task.event("received", time(), time(), {"name": "tasks.add", "args": (2, 2)})
self.assertEqual(task.state, states.FAILURE)
self.assertEqual(task.name, "tasks.add")
self.assertTupleEqual(task.args, (2, 2))
task.event("retried", time(), time())
self.assertEqual(task.state, states.RETRY)
示例4: test_merge
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_merge(self):
task = Task()
task.event('failed', time(), time())
task.event('started', time(), time())
task.event('received', time(), time(), {
'name': 'tasks.add', 'args': (2, 2),
})
assert task.state == states.FAILURE
assert task.name == 'tasks.add'
assert task.args == (2, 2)
task.event('retried', time(), time())
assert task.state == states.RETRY
示例5: test_merge
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_merge(self):
task = Task()
task.event('failed', time(), time())
task.event('started', time(), time())
task.event('received', time(), time(), {
'name': 'tasks.add', 'args': (2, 2),
})
self.assertEqual(task.state, states.FAILURE)
self.assertEqual(task.name, 'tasks.add')
self.assertTupleEqual(task.args, (2, 2))
task.event('retried', time(), time())
self.assertEqual(task.state, states.RETRY)
示例6: test_sent
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_sent(self):
task = Task(uuid='abcdefg',
name='tasks.add')
task.event('sent', time(), time())
assert task.state == states.PENDING
示例7: test_sent
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_sent(self):
task = Task(uuid='abcdefg',
name='tasks.add')
task.event('sent', time(), time())
self.assertEqual(task.state, states.PENDING)
示例8: test_sent
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_sent(self):
task = Task(uuid="abcdefg", name="tasks.add")
task.event("sent", time(), time())
self.assertEqual(task.state, states.PENDING)
示例9: test_ready
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import event [as 别名]
def test_ready(self):
task = Task(uuid="abcdefg", name="tasks.add")
task.event("received", time(), time())
self.assertFalse(task.ready)
task.event("succeeded", time(), time())
self.assertTrue(task.ready)