Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #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)
Exemple #4
0
 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()
Exemple #5
0
 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()
Exemple #6
0
 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)
Exemple #7
0
 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)