4904: Inspect event type and only print collection create events.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Mon, 19 Jan 2015 16:28:02 +0000 (11:28 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Mon, 19 Jan 2015 16:28:02 +0000 (11:28 -0500)
doc/_includes/_events_py.liquid

index b631d940d06e5fb7f45f14274b46ae11802613b8..3f6f40f9295997085d5cedd008e972efad5041d7 100644 (file)
@@ -6,9 +6,10 @@ import json
 
 # 'ev' is a dict containing the log table record describing the change.
 def on_message(ev):
-    # Your code here.
-    print json.dumps(ev)
-
+    if ('event_type' in ev and
+        ev['event_type'] == 'create' and
+        ev["object_kind"] == "arvados#collection"):
+        print "A new collection was created %s" % ev['object_uuid']
 
 api = arvados.api('v1', cache=False)
 ws = arvados.events.subscribe(api, [], on_message)