How to use the pysyncobj.pysyncobj3.syncobj.SyncObjException function in pysyncobj

To help you get started, we’ve selected a few pysyncobj examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bakwc / PySyncObj / pysyncobj / pysyncobj3 / syncobj.py View on Github external
def waitBinded(self):
        """
        Waits until initialized (binded port).
        If success - just returns.
        If failed to initialized after conf.maxBindRetries - raise SyncObjException.
        """
        self.__bindedEvent.wait()
        if not self.__isInitialized:
            raise SyncObjException('BindError')
github bakwc / PySyncObj / pysyncobj / pysyncobj3 / syncobj.py View on Github external
error = None
            event = threading.Event()
        def rep_cb(res, err):
            local.result = res
            local.error = err
            local.event.set()
        if kwargs.get('_doApply', False):
            return replicated(func)(self, *args, **kwargs)
        else:
            kwargs["callback"] = rep_cb
            replicated(func)(self, *args, **kwargs)
            res = local.event.wait(timeout = timeout)
            if not res:
                raise SyncObjException('Timeout')
            if not local.error == 0:
                raise SyncObjException(local.error)
            return local.result
    return newFunc
github bakwc / PySyncObj / pysyncobj / pysyncobj3 / syncobj.py View on Github external
class local:
            result = None
            error = None
            event = threading.Event()
        def rep_cb(res, err):
            local.result = res
            local.error = err
            local.event.set()
        if kwargs.get('_doApply', False):
            return replicated(func)(self, *args, **kwargs)
        else:
            kwargs["callback"] = rep_cb
            replicated(func)(self, *args, **kwargs)
            res = local.event.wait(timeout = timeout)
            if not res:
                raise SyncObjException('Timeout')
            if not local.error == 0:
                raise SyncObjException(local.error)
            return local.result
    return newFunc
github bakwc / PySyncObj / pysyncobj / pysyncobj3 / syncobj.py View on Github external
shouldConnect = None
            else:
                shouldConnect = True
            self.__nodes = []
            for nodeAddr in self.__otherNodesAddrs:
                self.__nodes.append(Node(self, nodeAddr, shouldConnect))
                self.__raftNextIndex[nodeAddr] = self.__getCurrentLogIndex() + 1
                self.__raftMatchIndex[nodeAddr] = 0
            self.__needLoadDumpFile = True
            self.__isInitialized = True
            self.__bindedEvent.set()
        except:
            self.__bindRetries += 1
            if self.__conf.maxBindRetries and self.__bindRetries >= self.__conf.maxBindRetries:
                self.__bindedEvent.set()
                raise SyncObjException('BindError')
            logging.exception('failed to perform initialization')