Example #1
0
 async def listen(self):
     data = None
     while True:
         obj = await self.read_pyon()
         try:
             action = obj["action"]
             if action == "terminate":
                 self.close_cb()
                 return
             elif action == "mod":
                 mod = obj["mod"]
                 if mod["action"] == "init":
                     data = self.init_cb(mod["struct"])
                 else:
                     process_mod(data, mod)
                 self.mod_cb(mod)
             else:
                 raise ValueError("unknown action in parent message")
         except:
             logger.error("error processing parent message", exc_info=True)
             self.close_cb()
Example #2
0
 def update(self, mod):
     process_mod(self.data, mod)
Example #3
0
 def update(self, mod):
     # Copy mod before applying to avoid sharing references to objects
     # between this and the DatasetManager, which would lead to mods being
     # applied twice.
     process_mod(self.data, copy.deepcopy(mod))
Example #4
0
 def update(self, mod):
     process_mod(self.model, mod)
     for notify_cb in self.notify_cbs:
         notify_cb(mod)