• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tasks._queue_reserved_task函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pulp.server..tasks._queue_reserved_task函数的典型用法代码示例。如果您正苦于以下问题:Python _queue_reserved_task函数的具体用法?Python _queue_reserved_task怎么用?Python _queue_reserved_task使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_queue_reserved_task函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_dispatches__release_resource

 def test_dispatches__release_resource(self):
     self.mock_get_worker_for_reservation.return_value = Worker(
         name='worker1', last_heartbeat=datetime.utcnow())
     tasks._queue_reserved_task('task_name', 'my_task_id', 'my_resource_id', [1, 2], {'a': 2})
     self.mock__release_resource.apply_async.assert_called_once_with(('my_task_id',),
                                                                     routing_key='worker1',
                                                                     exchange='C.dq')
开发者ID:zjhuntin,项目名称:pulp,代码行数:7,代码来源:test_tasks.py


示例2: test_dispatches_inner_task

 def test_dispatches_inner_task(self):
     self.mock_get_worker_for_reservation.return_value = Worker(
         name='worker1', last_heartbeat=datetime.utcnow())
     tasks._queue_reserved_task('task_name', 'my_task_id', 'my_resource_id', [1, 2], {'a': 2})
     apply_async = self.mock_celery.tasks['task_name'].apply_async
     apply_async.assert_called_once_with(1, 2, a=2, routing_key='worker1', task_id='my_task_id',
                                         exchange='C.dq')
开发者ID:zjhuntin,项目名称:pulp,代码行数:7,代码来源:test_tasks.py


示例3: test_creates_and_saves_reserved_resource

 def test_creates_and_saves_reserved_resource(self):
     self.mock_get_worker_for_reservation.return_value = Worker(
         name='worker1', last_heartbeat=datetime.utcnow())
     tasks._queue_reserved_task('task_name', 'my_task_id', 'my_resource_id', [1, 2], {'a': 2})
     self.mock_reserved_resource.assert_called_once_with(task_id='my_task_id',
                                                         worker_name='worker1',
                                                         resource_id='my_resource_id')
     self.mock_reserved_resource.return_value.save.assert_called_once_with()
开发者ID:zjhuntin,项目名称:pulp,代码行数:8,代码来源:test_tasks.py


示例4: test_loops_and_sleeps_waiting_for_available_worker

    def test_loops_and_sleeps_waiting_for_available_worker(self):
        self.mock_get_worker_for_reservation.side_effect = NoWorkers()
        self.mock_get_unreserved_worker.side_effect = NoWorkers()

        class BreakOutException(Exception):
            pass

        def side_effect(*args):
            def second_call(*args):
                raise BreakOutException()
            self.mock_time.sleep.side_effect = second_call
            return None

        self.mock_time.sleep.side_effect = side_effect

        try:
            tasks._queue_reserved_task('task_name', 'my_task_id', 'my_resource_id', [1, 2],
                                       {'a': 2})
        except BreakOutException:
            pass
        else:
            self.fail('_queue_reserved_task should have raised a BreakOutException')

        self.mock_time.sleep.assert_has_calls([mock.call(0.25), mock.call(0.25)])
开发者ID:hgschmie,项目名称:pulp,代码行数:24,代码来源:test_tasks.py


示例5: test_get_unreserved_worker_breaks_out_of_loop

 def test_get_unreserved_worker_breaks_out_of_loop(self):
     self.mock_get_worker_for_reservation.side_effect = NoWorkers()
     self.mock_get_unreserved_worker.return_value = Worker('worker1', datetime.utcnow())
     tasks._queue_reserved_task('task_name', 'my_task_id', 'my_resource_id', [1, 2], {'a': 2})
     self.assertTrue(not self.mock_time.sleep.called)
开发者ID:hgschmie,项目名称:pulp,代码行数:5,代码来源:test_tasks.py


示例6: test_get_worker_for_reservation_breaks_out_of_loop

 def test_get_worker_for_reservation_breaks_out_of_loop(self):
     self.mock_get_worker_for_reservation.return_value = Worker(
         name='worker1', last_heartbeat=datetime.utcnow())
     tasks._queue_reserved_task('task_name', 'my_task_id', 'my_resource_id', [1, 2], {'a': 2})
     self.assertTrue(not self.mock_get_unreserved_worker.called)
     self.assertTrue(not self.mock_time.sleep.called)
开发者ID:zjhuntin,项目名称:pulp,代码行数:6,代码来源:test_tasks.py



注:本文中的pulp.server..tasks._queue_reserved_task函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tasks.cancel函数代码示例发布时间:2022-05-25
下一篇:
Python tasks._delete_worker函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap