本文整理汇总了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()
示例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, {})