Subscribing to events

Arvados applications can subscribe to a live event stream from the database. Events are described in the Log resource.

#!/usr/bin/env python

import arvados
import arvados.events

# 'ev' is a dict containing the log table record describing the change.
def on_message(ev):
    if ev.get("event_type") == "create" and ev.get("object_kind") == "arvados#collection":
        print "A new collection was created: %s" % ev["object_uuid"]

api = arvados.api("v1")
ws = arvados.events.subscribe(api, [], on_message)
ws.run_forever()

Previous: Arvados FUSE driver Next: Code cookbook

The content of this documentation is licensed under the Creative Commons Attribution-Share Alike 3.0 United States licence.
Code samples in this documentation are licensed under the Apache License, Version 2.0.