X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f6b88a9e7e9727f0397f1febbad8c08f6a20463d..88f57312fe5e2226f113dc5ecb0a5edce018701d:/sdk/python/arvados/events.py diff --git a/sdk/python/arvados/events.py b/sdk/python/arvados/events.py index 268692637a..09f2a871a9 100644 --- a/sdk/python/arvados/events.py +++ b/sdk/python/arvados/events.py @@ -65,6 +65,7 @@ class PollClient(threading.Thread): self.filters = [[]] self.on_event = on_event self.poll_time = poll_time + self.daemon = True self.stop = threading.Event() def run(self): @@ -129,12 +130,17 @@ def _subscribe_websocket(api, filters, on_event): client.close_connection() def subscribe(api, filters, on_event, poll_fallback=15): - ''' - api: a client object retrieved from arvados.api(). The caller should not use this client object for anything else after calling subscribe(). - filters: Initial subscription filters. - on_event: The callback when a message is received. - poll_fallback: If websockets are not available, fall back to polling every N seconds. If poll_fallback=False, this will return None if websockets are not available. - ''' + """ + :api: + a client object retrieved from arvados.api(). The caller should not use this client object for anything else after calling subscribe(). + :filters: + Initial subscription filters. + :on_event: + The callback when a message is received. + :poll_fallback: + If websockets are not available, fall back to polling every N seconds. If poll_fallback=False, this will return None if websockets are not available. + """ + if not poll_fallback: return _subscribe_websocket(api, filters, on_event)