Raise NotImplementedError instead of NotImplemented
NotImplementedError is the name of the exception (https://docs.python.org/2/library/exceptions.html). NotImplemented is the name of a constant (https://docs.python.org/2/library/constants.html). >>> raise NotImplemented() Traceback (most recent call last): File "<pyshell#31>", line 1, in <module> raise NotImplemented() TypeError: 'NotImplementedType' object is not callable >>> raise NotImplementedError() Traceback (most recent call last): File "<pyshell#32>", line 1, in <module> raise NotImplementedError() NotImplementedError This patch fix it. Change-Id: If4ea80c9e72478a9547c0c125d7cc1a5a1eccd1f Closes-Bug: #1339855
This commit is contained in:
parent
a4c49fab02
commit
38e15a82c0
@ -130,7 +130,7 @@ class _Lock(object):
|
||||
|
||||
@classmethod
|
||||
def _acquire(cls, uid, identity):
|
||||
raise NotImplemented(
|
||||
raise NotImplementedError(
|
||||
'Different strategies for handling collisions')
|
||||
|
||||
@classmethod
|
||||
|
@ -34,18 +34,18 @@ class Executor(object):
|
||||
self.worker._executor = self
|
||||
|
||||
def register_task(self, ctxt):
|
||||
raise NotImplemented(
|
||||
raise NotImplementedError(
|
||||
'Register task should be implemented'
|
||||
' to support task interruption.')
|
||||
|
||||
def register_timeout(self, timeout, callable_):
|
||||
raise NotImplemented(
|
||||
raise NotImplementedError(
|
||||
'Should be implemented to propagate errors by timeout')
|
||||
|
||||
def kill(self, task_id, exc):
|
||||
raise NotImplemented(
|
||||
raise NotImplementedError(
|
||||
'Kill should be implemented'
|
||||
' to support task interruption.')
|
||||
|
||||
def run(self):
|
||||
raise NotImplemented()
|
||||
raise NotImplementedError()
|
||||
|
@ -137,7 +137,7 @@ class Scheduler(base.Worker):
|
||||
|
||||
def _configure_timeout(self, ctxt, timeout):
|
||||
if not hasattr(self._executor, 'register_timeout'):
|
||||
raise NotImplemented('Timeout is not supported')
|
||||
raise NotImplementedError('Timeout is not supported')
|
||||
self._executor.register_timeout(
|
||||
timeout,
|
||||
partial(self.update_next, ctxt,
|
||||
|
@ -33,7 +33,7 @@ class SubControl(object):
|
||||
self.add_subscriber(sub, 'before')
|
||||
|
||||
def add_subscriber(self, sub, event):
|
||||
raise NotImplemented()
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class FuncSubControl(SubControl):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2015 Mirantis, Inc.
|
||||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@ -44,6 +44,6 @@ class Tasks(base.Worker):
|
||||
def kill(self, ctxt, task_id):
|
||||
log.debug('Received kill request for task_id %s', task_id)
|
||||
if not hasattr(self._executor, 'kill'):
|
||||
raise NotImplemented(
|
||||
raise NotImplementedError(
|
||||
'Current executor doesnt support interruping tasks')
|
||||
self._executor.kill(task_id, ExecutionTimeout)
|
||||
|
Loading…
Reference in New Issue
Block a user