本文整理汇总了Python中celery.events.state.Task.info方法的典型用法代码示例。如果您正苦于以下问题:Python Task.info方法的具体用法?Python Task.info怎么用?Python Task.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.events.state.Task
的用法示例。
在下文中一共展示了Task.info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_info
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import info [as 别名]
def test_info(self):
task = Task(uuid='abcdefg',
name='tasks.add',
args='(2, 2)',
kwargs='{}',
retries=2,
result=42,
eta=1,
runtime=0.0001,
expires=1,
parent_id='bdefc',
root_id='dedfef',
foo=None,
exception=1,
received=time() - 10,
started=time() - 8,
exchange='celery',
routing_key='celery',
succeeded=time())
assert sorted(list(task._info_fields)) == sorted(task.info().keys())
assert (sorted(list(task._info_fields + ('received',))) ==
sorted(task.info(extra=('received',))))
assert (sorted(['args', 'kwargs']) ==
sorted(task.info(['args', 'kwargs']).keys()))
assert not list(task.info('foo'))
示例2: test_info
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import info [as 别名]
def test_info(self):
task = Task(
uuid="abcdefg",
name="tasks.add",
args="(2, 2)",
kwargs="{}",
retries=2,
result=42,
eta=1,
runtime=0.0001,
expires=1,
foo=None,
exception=1,
received=time() - 10,
started=time() - 8,
exchange="celery",
routing_key="celery",
succeeded=time(),
)
self.assertEqual(sorted(list(task._info_fields)), sorted(task.info().keys()))
self.assertEqual(sorted(list(task._info_fields + ("received",))), sorted(task.info(extra=("received",))))
self.assertEqual(sorted(["args", "kwargs"]), sorted(task.info(["args", "kwargs"]).keys()))
self.assertFalse(list(task.info("foo")))
示例3: test_info
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import info [as 别名]
def test_info(self):
task = Task(uuid="abcdefg",
name="tasks.add",
args="(2, 2)",
kwargs="{}",
retries=2,
result=42,
eta=1,
runtime=0.0001,
expires=1,
exception=1,
received=time() - 10,
started=time() - 8,
succeeded=time())
self.assertItemsEqual(list(task._info_fields),
task.info().keys())
self.assertItemsEqual(list(task._info_fields + ("received", )),
task.info(extra=("received", )))
self.assertItemsEqual(["args", "kwargs"],
task.info(["args", "kwargs"]).keys())
示例4: test_info
# 需要导入模块: from celery.events.state import Task [as 别名]
# 或者: from celery.events.state.Task import info [as 别名]
def test_info(self):
task = Task(uuid='abcdefg',
name='tasks.add',
args='(2, 2)',
kwargs='{}',
retries=2,
result=42,
eta=1,
runtime=0.0001,
expires=1,
exception=1,
received=time() - 10,
started=time() - 8,
succeeded=time())
self.assertEqual(sorted(list(task._info_fields)),
sorted(task.info().keys()))
self.assertEqual(sorted(list(task._info_fields + ('received', ))),
sorted(task.info(extra=('received', ))))
self.assertEqual(sorted(['args', 'kwargs']),
sorted(task.info(['args', 'kwargs']).keys()))