5 title: Subscribing to database events
8 Copyright (C) The Arvados Authors. All rights reserved.
10 SPDX-License-Identifier: CC-BY-SA-3.0
13 Arvados applications can subscribe to a live event stream from the database. Events are described in the "Log resource.":{{site.baseurl}}/api/methods/logs.html
15 {% codeblock as python %}
16 #!/usr/bin/env python3
21 # 'ev' is a dict containing the log table record describing the change.
23 if ev.get("event_type") == "create" and ev.get("object_kind") == "arvados#collection":
24 print "A new collection was created: %s" % ev["object_uuid"]
26 api = arvados.api("v1")
27 ws = arvados.events.subscribe(api, [], on_message)