projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add ModelEntity callbacks and async return values.
[osm/N2VC.git]
/
examples
/
allwatcher.py
diff --git
a/examples/allwatcher.py
b/examples/allwatcher.py
index
3f5ea06
..
ecd6e82
100644
(file)
--- a/
examples/allwatcher.py
+++ b/
examples/allwatcher.py
@@
-1,15
+1,19
@@
+"""
+This example:
+
+1. Connects to the current model
+2. Starts an AllWatcher
+3. Prints all changes received from the AllWatcher
+4. Runs forever (kill with Ctrl-C)
+
+"""
import asyncio
import logging
import asyncio
import logging
-logging.basicConfig(level=logging.DEBUG)
from juju.client.connection import Connection
from juju.client import watcher
from juju.client.connection import Connection
from juju.client import watcher
-loop = asyncio.get_event_loop()
-conn = loop.run_until_complete(Connection.connect_current())
-
-
async def watch():
allwatcher = watcher.AllWatcher()
allwatcher.connect(conn)
async def watch():
allwatcher = watcher.AllWatcher()
allwatcher.connect(conn)
@@
-18,4
+22,8
@@
async def watch():
for delta in change.deltas:
print(delta.deltas)
for delta in change.deltas:
print(delta.deltas)
+
+logging.basicConfig(level=logging.DEBUG)
+loop = asyncio.get_event_loop()
+conn = loop.run_until_complete(Connection.connect_current())
loop.run_until_complete(watch())
loop.run_until_complete(watch())