temptours+tours
This commit is contained in:
33
engine/engine.py
Normal file
33
engine/engine.py
Normal file
@ -0,0 +1,33 @@
|
||||
from mysql.connector import Error
|
||||
from engine.db import get_connection
|
||||
|
||||
from engine.engine_components.active_courses import get_active_con_ids
|
||||
from engine.engine_components.process_course import process_course
|
||||
from engine.logger import log_info, log_debug, log_warn, log_error
|
||||
|
||||
def run_once():
|
||||
try:
|
||||
cnx = get_connection()
|
||||
cur = cnx.cursor(dictionary=True)
|
||||
|
||||
con_ids = get_active_con_ids(cur)
|
||||
if not con_ids:
|
||||
log_info("[INFO] Aucune course active.")
|
||||
return
|
||||
|
||||
for con_id in con_ids:
|
||||
process_course(cur, cnx, con_id)
|
||||
|
||||
except Error as e:
|
||||
log_error(f"[ERREUR MYSQL] {e}")
|
||||
|
||||
finally:
|
||||
try:
|
||||
cur.close()
|
||||
cnx.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_once()
|
||||
Reference in New Issue
Block a user