21146: Add last_log_id argument to PollClient.subscribe 21146-pysdk-new-websockets
authorBrett Smith <brett.smith@curii.com>
Fri, 1 Dec 2023 15:18:13 +0000 (10:18 -0500)
committerBrett Smith <brett.smith@curii.com>
Fri, 1 Dec 2023 15:32:35 +0000 (10:32 -0500)
This helps avoid a crash if `subscribe` returns a `PollClient` and then
the user calls `subscribe` with two arguments. I don't know whether
ignoring `last_log_id` is *correct*, but that's the current behavior,
and anything else is out of scope for the current ticket.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

sdk/python/arvados/events.py

index 56650558e8d9d80d8202d2a4ac8372966ef74191..917c876706ffb2bcab4189d5fca1da430b37a1fc 100644 (file)
@@ -468,12 +468,15 @@ class PollClient(threading.Thread):
             # to do so raises the same exception."
             pass
 
-    def subscribe(self, f: Filter) -> None:
+    def subscribe(self, f: Filter, last_log_id: Optional[int]=None) -> None:
         """Subscribe to another set of events from the server
 
         Arguments:
 
         * f: arvados.events.Filter | None --- One filter to subscribe to.
+
+        * last_log_id: Optional[int] --- Ignored; this argument exists for
+          API compatibility with `EventClient.subscribe`.
         """
         self.on_event({'status': 200})
         self.filters.append(f)