本文整理汇总了Python中celery.backends.filesystem.FilesystemBackend类的典型用法代码示例。如果您正苦于以下问题:Python FilesystemBackend类的具体用法?Python FilesystemBackend怎么用?Python FilesystemBackend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FilesystemBackend类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_correct_result
def test_correct_result(self):
data = {'foo': 'bar'}
tb = FilesystemBackend(app=self.app, url=self.url)
tid = uuid()
tb.mark_as_done(tid, data)
self.assertEqual(tb.get_result(tid), data)
示例2: test_get_many
def test_get_many(self):
data = {uuid(): 'foo', uuid(): 'bar', uuid(): 'baz'}
tb = FilesystemBackend(app=self.app, url=self.url)
for key, value in data.items():
tb.mark_as_done(key, value)
for key, result in tb.get_many(data.keys()):
self.assertEqual(result['result'], data[key])
示例3: test_forget_deletes_file
def test_forget_deletes_file(self):
tb = FilesystemBackend(app=self.app, url=self.url)
tid = uuid()
tb.mark_as_done(tid, 42)
tb.forget(tid)
self.assertEqual(len(os.listdir(self.directory)), 0)
示例4: test_done_task_is_SUCCESS
def test_done_task_is_SUCCESS(self):
tb = FilesystemBackend(app=self.app, url=self.url)
tid = uuid()
tb.mark_as_done(tid, 42)
self.assertEqual(tb.get_state(tid), states.SUCCESS)
示例5: test_mark_as_done_writes_file
def test_mark_as_done_writes_file(self):
tb = FilesystemBackend(app=self.app, url=self.url)
tb.mark_as_done(uuid(), 42)
self.assertEqual(len(os.listdir(self.directory)), 1)
示例6: test_missing_task_is_PENDING
def test_missing_task_is_PENDING(self):
tb = FilesystemBackend(app=self.app, url=self.url)
self.assertEqual(tb.get_state('xxx-does-not-exist'), states.PENDING)