47eb999b528e5cb281f092b3b2f0458986889af1
4 1. Connects to the current model
5 2. Watches the model and prints all changes
6 3. Runs forever (kill with Ctrl-C)
11 from juju
.model
import Model
15 async def on_model_change(delta
, old
, new
, model
):
16 print(delta
.entity
, delta
.type, delta
.data
)
22 async def watch_model():
24 await model
.connect_current()
26 model
.add_observer(on_model_change
)
29 if __name__
== '__main__':
30 # Run loop until the process is manually stopped (watch_model will loop
32 loop
.run(watch_model())