def refresh(): db_conn.execute(sync_sql, []) # 同步主机ip数据 db_conn.commit() cursor = db_conn.execute(sql, []) rows = cursor.fetchall() cursor and cursor.close() for row in rows: DashBoardUrls[row[0]] = row[1] print 'endpoint dashboard urls' print(DashBoardUrls)
def teardown_request(exception): from rrd.store import dashboard_db_conn as db_conn try: db_conn and db_conn.commit() except ProgrammingError: pass from rrd.store import graph_db_conn try: graph_db_conn and graph_db_conn.commit() except ProgrammingError: pass