本文整理汇总了Python中pq.queue.Queue.dequeue_any方法的典型用法代码示例。如果您正苦于以下问题:Python Queue.dequeue_any方法的具体用法?Python Queue.dequeue_any怎么用?Python Queue.dequeue_any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pq.queue.Queue
的用法示例。
在下文中一共展示了Queue.dequeue_any方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dequeue_any_multiple
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_any_multiple(self):
job, queue = PQ.dequeue_any([self.fooq, self.barq], None)
self.assertEqual(queue, self.fooq)
self.assertEqual(job.func, say_hello)
self.assertEqual(job.origin, self.fooq.name)
self.assertEqual(
job.args[0], 'for Foo', 'Foo should be dequeued first.')
job, queue = PQ.dequeue_any([self.fooq, self.barq], None)
self.assertEqual(queue, self.barq)
self.assertEqual(job.func, say_hello)
self.assertEqual(job.origin, self.barq.name)
self.assertEqual(
job.args[0], 'for Bar', 'Bar should be dequeued second.')
示例2: test_dequeue_any_serial_lock_expired
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_any_serial_lock_expired(self):
"""Test that it raises a DequeueTimeout timeout"""
time.sleep(1)
job, queue = Queue.dequeue_any([self.sq], timeout=1)
self.assertEquals(self.job.id, job.id)
示例3: test_dequeue_any_serial_lock
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_any_serial_lock(self):
"""Test that it raises a DequeueTimeout timeout"""
with self.assertRaises(DequeueTimeout):
Queue.dequeue_any([self.sq], timeout=1)
示例4: test_dequeue_any_serial
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_any_serial(self):
job, queue = Queue.dequeue_any([self.sq], timeout=10)
self.assertEquals(job.func, do_nothing)
示例5: test_dequeue_timeout
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_timeout(self):
with self.assertRaises(DequeueTimeout):
PQ.dequeue_any([self.q], timeout=1)
示例6: test_dequeue_any_single
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_any_single(self):
job, queue = PQ.dequeue_any([self.fooq, self.barq], None)
self.assertEquals(job.func, say_hello)
self.assertEquals(queue, self.barq)
示例7: test_dequeue_any_empty
# 需要导入模块: from pq.queue import Queue [as 别名]
# 或者: from pq.queue.Queue import dequeue_any [as 别名]
def test_dequeue_any_empty(self):
"""Fetching work from any given queue."""
self.assertEquals(PQ.dequeue_any([self.fooq, self.barq], None), None)