def stat(self, in_time_id): if not super(HostCluster, self).stat(in_time_id): logger.error("Returned from HC.stat") return False dep_dn = self.get_dependants(True) if not dep_dn: logger.error("Returned from HC.stat no dependants returned") return False for dn_set in dep_dn: dn = DatabaseName(self.db_conn, dn_set["db_dsn"], dn_set["id"]) if not dn.stat(in_time_id): logger.error("Error in HC.stat False from db.stat") dn.__del__() return True
lt=LogTime() work_cursor=database.db_conn.cursor() work_cursor.execute("SELECT id FROM host_cluster WHERE alive AND observable") for hc_id in work_cursor.fetchall(): hc=HostCluster(hc_id[0]) hc.discover_cluster_params() hc.stat(lt.id) for dbs in hc.get_dependants(obs=True): db_conn_string=hc.return_conn_string(dbs['db_name']) dn=DatabaseName(dbs['id'],db_conn_string) dn.stat(lt.id) db_cursor=dn.get_prod_cursor() if db_cursor: for sn_id in dn.get_dependants(obs=True): sn=SchemaName(sn_id) sn.discover_tables(db_cursor) sn.discover_functions(db_cursor) for tbl_id in sn.get_tables(): tn=TableName(tbl_id) tn.stat(lt.id,db_cursor) tn.va_stat(lt.id,db_cursor) tn.discover_indexes(db_cursor) for ind_id in tn.get_dependants(): ind=IndexName(ind_id) ind.stat(lt.id,db_cursor) tn.discover_toast(db_cursor)