コード例 #1
0
ファイル: _threads.py プロジェクト: robdennis/sideboard
 def __init__(self, func, interval=0.1, threads=1):
     self.lock = Lock()
     self.threads = []
     self.stopped = Event()
     self.func, self.interval, self.thread_count = func, interval, threads
     on_startup(self.start)
     on_shutdown(self.stop)
コード例 #2
0
ファイル: _websockets.py プロジェクト: msg4real/sideboard
 def __init__(self, hostnames, rpc_method, *args, **kwargs):
     from sideboard.lib import listify
     self.hostnames, self.method, self.args, self.kwargs = listify(
         hostnames), rpc_method, args, kwargs
     self.results, self.websockets, self._client_ids = {}, {}, {}
     on_startup(self._subscribe)
     on_shutdown(self._unsubscribe)
コード例 #3
0
    def __init__(self, func, interval=None, threads=1, name=None):
        self.lock = Lock()
        self.threads = []
        self.stopped = Event()
        self.func, self.interval, self.thread_count = func, interval, threads
        self.name = name or self.func.__name__

        on_startup(self.start)
        on_shutdown(self.stop)
コード例 #4
0
ファイル: _websockets.py プロジェクト: robdennis/sideboard
 def __init__(self, rpc_method, *args, **kwargs):
     self.result = None
     connect_immediately = kwargs.pop('connect_immediately', False)
     self.method, self.args, self.kwargs = rpc_method, args, kwargs
     self.ws = sideboard.lib.services.get_websocket(rpc_method.split('.')[0])
     on_startup(self._subscribe)
     on_shutdown(self._unsubscribe)
     if connect_immediately:
         self.ws.connect(max_wait=2)
         self._subscribe()
コード例 #5
0
ファイル: _websockets.py プロジェクト: eanderton/sideboard
 def __init__(self, rpc_method, *args, **kwargs):
     self.result = None
     connect_immediately = kwargs.pop('connect_immediately', False)
     self.method, self.args, self.kwargs = rpc_method, args, kwargs
     self.ws = sideboard.lib.services.get_websocket(rpc_method.split('.')[0])
     on_startup(self._subscribe)
     on_shutdown(self._unsubscribe)
     if connect_immediately:
         self.ws.connect(max_wait=2)
         self._subscribe()
コード例 #6
0
ファイル: _websockets.py プロジェクト: ftobia/sideboard
 def __init__(self, url=None):
     self.ws = None
     self.url = url or self.default_url
     assert self.url, 'no url or default url provided'
     self._lock = RLock()
     self._callbacks = {}
     self._counter = count()
     self._reconnect_attempts = 0
     self._last_poll, self._last_reconnect_attempt = None, None
     self._checker = threads.DaemonTask(self._check, interval=1)
     self._dispatcher = threads.Caller(self._dispatch, threads=1)
     self._dispatcher.start()
     self._checker.start()
     on_shutdown(self._checker.stop)
     on_shutdown(self._dispatcher.stop)
コード例 #7
0
ファイル: _websockets.py プロジェクト: ftobia/sideboard
 def __init__(self, rpc_method, *args, **kwargs):
     self.ws = None
     self.method, self.args, self.kwargs = rpc_method, args, kwargs
     on_startup(self.connect)
     on_shutdown(self.disconnect)
コード例 #8
0
ファイル: _websockets.py プロジェクト: magfest/sideboard
 def __init__(self, hostnames, rpc_method, *args, **kwargs):
     from sideboard.lib import listify
     self.hostnames, self.method, self.args, self.kwargs = listify(hostnames), rpc_method, args, kwargs
     self.results, self.websockets, self._client_ids = {}, {}, {}
     on_startup(self._subscribe)
     on_shutdown(self._unsubscribe)