def reload(self): """ Reloads components status snapshot from disk. """ self._components = self._persistance.load() for configuration in self._configuration.itervalues(): if not configuration.uid in self._components: self._components[ configuration.uid] = Component.create_instance( typeid=configuration.typeid, uid=configuration.uid, configuration=configuration) else: self._components[ configuration.uid].configuration = configuration self._detached = list() for uid in self._components: if not uid in self._configuration: if not self._components[uid].is_alive: self._persistance.delete_status(uid) else: self._components[uid] = DetachedComponent( **self._components[uid].__dict__) self._detached.append(uid)
def reload(self): """ Reloads components status snapshot from disk. """ self._components = self._persistance.load() for configuration in self._configuration.itervalues(): if not configuration.uid in self._components: self._components[configuration.uid] = Component.create_instance(typeid = configuration.typeid, uid = configuration.uid, configuration = configuration) else: self._components[configuration.uid].configuration = configuration
def load(self): """Loads components status data from the status file""" components = dict() c = self.__conn.cursor() c.execute(self.__SELECT_STATUS__) for row in c.fetchall(): args = dict(**row) args["status_persistance"] = self component = Component.create_instance(**args) components[component.uid] = component return components