def registerPlugin(self, plugin): self.pluginList.append(plugin) for user in user_def.getUsers(): for e in plugin.getEventList(): ep = user_def.EventProfile(e,plugin.getActionList()) user.addEventProfile(ep) plugin.manager = self plugin.registered = 1 plugin.start() #don't forget to start the plugin's thread
def run(self): # logging.info("starting festival server") # self.festival = festival.FestivalWrapper() # self.festival.start() logging.warning("STARTING") while not self.finished: newEvent = self.eventqueue.get() # python's bug: can't be killed by Ctrl+C logging.debug("get event %s", newEvent.name) newTasks = list() for u in user_def.getUsers(): ep = u.getProfileByEvent(newEvent) newTasks.extend(ep.getActions()) newEvent.actionArgs.update( {"testArg": "fromEngine"} ) # optional, but the engine could add info on users or whatever state it wants and give that to the action for t in newTasks: t(newEvent.actionArgs) t.treated = 1 time.sleep(5) # TODO: remove ugly sleep and wait on all plugins to stop instead logging.warning("STOPPING")