本文整理匯總了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)