Merge "typing: Add argument to tooz.NotImplementedError"
This commit is contained in:
@@ -305,12 +305,12 @@ class CoordinationDriver:
|
||||
This may also activate :py:meth:`.run_elect_coordinator` (depending
|
||||
on driver implementation).
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def run_elect_coordinator():
|
||||
"""Try to leader elect this coordinator & activate hooks on success."""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
def watch_join_group(self, group_id, callback):
|
||||
"""Call a function when group_id sees a new member joined.
|
||||
@@ -413,7 +413,7 @@ class CoordinationDriver:
|
||||
|
||||
:param group_id: The group where we don't want to be a leader anymore
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@property
|
||||
def is_started(self):
|
||||
@@ -480,7 +480,7 @@ class CoordinationDriver:
|
||||
:returns: None
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_groups():
|
||||
@@ -489,7 +489,7 @@ class CoordinationDriver:
|
||||
:returns: the list of all created group ids
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def join_group(group_id, capabilities=b""):
|
||||
@@ -502,7 +502,7 @@ class CoordinationDriver:
|
||||
:returns: None
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@_retry.retry()
|
||||
def join_group_create(self, group_id, capabilities=b""):
|
||||
@@ -540,7 +540,7 @@ class CoordinationDriver:
|
||||
:returns: None
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def delete_group(group_id):
|
||||
@@ -551,7 +551,7 @@ class CoordinationDriver:
|
||||
:returns: Result
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_members(group_id):
|
||||
@@ -560,7 +560,7 @@ class CoordinationDriver:
|
||||
:returns: set of all member ids in the specified group
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_member_capabilities(group_id, member_id):
|
||||
@@ -573,7 +573,7 @@ class CoordinationDriver:
|
||||
:returns: capabilities of a member
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_member_info(group_id, member_id):
|
||||
@@ -586,7 +586,7 @@ class CoordinationDriver:
|
||||
:returns: capabilities and statistics of a member
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def update_capabilities(group_id, capabilities):
|
||||
@@ -599,7 +599,7 @@ class CoordinationDriver:
|
||||
:returns: None
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_leader(group_id):
|
||||
@@ -609,7 +609,7 @@ class CoordinationDriver:
|
||||
:returns: the leader
|
||||
:rtype: CoordAsyncResult
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_lock(name):
|
||||
@@ -620,9 +620,8 @@ class CoordinationDriver:
|
||||
|
||||
:param name: The lock name that is used to identify it across all
|
||||
nodes.
|
||||
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def heartbeat():
|
||||
|
||||
@@ -64,9 +64,9 @@ class ConsulLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
if timeout:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@_retry.retry(stop_max_delay=blocking)
|
||||
@_translate_failures
|
||||
@@ -512,11 +512,11 @@ class ConsulDriver(
|
||||
|
||||
@staticmethod
|
||||
def watch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
|
||||
ConsulFutureResult = functools.partial(
|
||||
|
||||
@@ -104,7 +104,7 @@ class EtcdLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
blocking, timeout = utils.convert_blocking(blocking, timeout)
|
||||
if timeout is not None:
|
||||
@@ -288,13 +288,13 @@ class EtcdDriver(coordination.CoordinationDriver):
|
||||
return self.lock_timeout
|
||||
|
||||
def watch_join_group(self, group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
def unwatch_join_group(self, group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
def watch_leave_group(self, group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
def unwatch_leave_group(self, group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@@ -76,7 +76,7 @@ class Etcd3Lock(locking.Lock):
|
||||
@_translate_failures
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
if timeout is None:
|
||||
timeout = self._timeout
|
||||
|
||||
@@ -481,8 +481,8 @@ class Etcd3Driver(
|
||||
|
||||
@staticmethod
|
||||
def watch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@@ -525,11 +525,11 @@ class FileDriver(
|
||||
|
||||
@staticmethod
|
||||
def watch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
|
||||
FileFutureResult = functools.partial(
|
||||
|
||||
@@ -72,7 +72,7 @@ class IPCLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
if (
|
||||
blocking is not True
|
||||
|
||||
@@ -46,7 +46,7 @@ class KubernetesLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, expire=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
blocking, timeout = utils.convert_blocking(blocking)
|
||||
sherlock.configure(
|
||||
expire=expire, timeout=int(timeout) if timeout else timeout
|
||||
|
||||
@@ -85,9 +85,9 @@ class MemcachedLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
if timeout is not None:
|
||||
raise tooz.Timeout
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@_retry.retry(stop_max_delay=blocking)
|
||||
@_translate_failures
|
||||
|
||||
@@ -38,7 +38,7 @@ class MySQLLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@_retry.retry(stop_max_delay=blocking)
|
||||
def _lock(timeout):
|
||||
@@ -167,27 +167,27 @@ class MySQLDriver(coordination.CoordinationDriver):
|
||||
|
||||
@staticmethod
|
||||
def watch_join_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_join_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def watch_leave_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_leave_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def watch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_connection(parsed_url, options, defer_connect=False):
|
||||
|
||||
@@ -101,9 +101,9 @@ class PostgresLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
if timeout is not None:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@_retry.retry(stop_max_delay=blocking)
|
||||
def _lock():
|
||||
@@ -204,27 +204,27 @@ class PostgresDriver(coordination.CoordinationDriver):
|
||||
|
||||
@staticmethod
|
||||
def watch_join_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_join_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def watch_leave_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_leave_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def watch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def unwatch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@staticmethod
|
||||
def get_connection(parsed_url, options):
|
||||
|
||||
@@ -100,7 +100,7 @@ class RedisLock(locking.Lock):
|
||||
@_handle_failures()
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
blocking, timeout = utils.convert_blocking(blocking, timeout)
|
||||
acquired = self._lock.acquire(
|
||||
blocking=blocking, blocking_timeout=timeout
|
||||
@@ -523,11 +523,9 @@ return 1
|
||||
)
|
||||
if not new_enough:
|
||||
raise tooz.NotImplemented(
|
||||
"Redis version greater than or"
|
||||
f" equal to '{self.MIN_VERSION}' is required"
|
||||
f" to use this driver; '{redis_version}' is"
|
||||
" being used which is not new"
|
||||
" enough"
|
||||
f"Redis version greater than or equal to "
|
||||
f"'{self.MIN_VERSION}' is required to use this driver; "
|
||||
f"'{redis_version}' is being used which is not new enough"
|
||||
)
|
||||
tpl_params = {
|
||||
'group_existence_value': self.GROUP_EXISTS_VALUE,
|
||||
|
||||
@@ -61,7 +61,7 @@ class ZooKeeperLock(locking.Lock):
|
||||
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
if shared:
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
blocking, timeout = utils.convert_blocking(blocking, timeout)
|
||||
return self._lock.acquire(blocking=blocking, timeout=timeout)
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class Lock(metaclass=abc.ABCMeta):
|
||||
false if the lock was never acquired in the first place
|
||||
or raises ``NotImplemented`` if not implemented.
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@abc.abstractmethod
|
||||
def release(self):
|
||||
@@ -90,7 +90,7 @@ class Lock(metaclass=abc.ABCMeta):
|
||||
:returns: returns true if forcefully broken (false if not)
|
||||
or raises ``NotImplemented`` if not implemented.
|
||||
"""
|
||||
raise tooz.NotImplemented
|
||||
raise tooz.NotImplemented("not implemented")
|
||||
|
||||
@abc.abstractmethod
|
||||
def acquire(self, blocking=True, shared=False, timeout=None):
|
||||
|
||||
Reference in New Issue
Block a user