当前位置: 首页>>代码示例>>Python>>正文


Python GroupState.remove_job方法代码示例

本文整理汇总了Python中otter.models.interface.GroupState.remove_job方法的典型用法代码示例。如果您正苦于以下问题:Python GroupState.remove_job方法的具体用法?Python GroupState.remove_job怎么用?Python GroupState.remove_job使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在otter.models.interface.GroupState的用法示例。


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

示例1: test_pending_server_delete

# 需要导入模块: from otter.models.interface import GroupState [as 别名]
# 或者: from otter.models.interface.GroupState import remove_job [as 别名]
    def test_pending_server_delete(self):
        """
        When a pending job is cancelled, it is deleted from the job list. When
        the server finishes building, then ``execute_launch_config`` is called
        to remove the job from pending job list. It then notices that pending
        job_id is not there in job list and calls ``execute_delete_server``
        to delete the server.
        """
        self.supervisor.execute_delete_server.return_value = succeed(None)

        s = GroupState('tenant', 'group', 'name', {}, {'1': {}}, None, {}, False)

        def fake_modify_state(callback, *args, **kwargs):
            callback(self.group, s, *args, **kwargs)

        self.group.modify_state.side_effect = fake_modify_state
        supervisor.execute_launch_config(self.log, '1', self.fake_state,
                                         'launch', self.group, 1)

        s.remove_job('1')
        self.execute_config_deferreds[0].callback({'id': 's1'})

        # first bind is system='otter.job.launch', second is job_id='1'
        self.del_job.assert_called_once_with(
            matches(IsInstance(self.log.__class__)), '1', self.group,
            {'id': 's1'}, self.supervisor)
        self.del_job.return_value.start.assert_called_once_with()
开发者ID:dwcramer,项目名称:otter,代码行数:29,代码来源:test_supervisor.py

示例2: test_remove_job_success

# 需要导入模块: from otter.models.interface import GroupState [as 别名]
# 或者: from otter.models.interface.GroupState import remove_job [as 别名]
 def test_remove_job_success(self):
     """
     If the job ID is in the pending list, ``remove_job`` removes it.
     """
     state = GroupState('tid', 'gid', 'name', {}, {'1': {}}, None, {}, True)
     state.remove_job('1')
     self.assertEqual(state.pending, {})
开发者ID:zancas,项目名称:otter,代码行数:9,代码来源:test_interface.py


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