2022-05-01 19:57:16 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Do housekeeping actions on the database.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import configuration
|
|
|
|
|
from datastore import Datastore
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
print("Reading configuration")
|
|
|
|
|
surveys = configuration.surveys()
|
|
|
|
|
|
|
|
|
|
print("Connecting to database")
|
|
|
|
|
db = Datastore()
|
|
|
|
|
|
|
|
|
|
print("Reading surveys")
|
|
|
|
|
for survey in surveys:
|
|
|
|
|
print(f'Survey: {survey["id"]} ({survey["schema"]})')
|
|
|
|
|
db.set_survey(survey["schema"])
|
|
|
|
|
|
2022-05-08 15:26:15 +02:00
|
|
|
print("Planner adjustment")
|
2022-05-01 20:27:19 +02:00
|
|
|
db.adjust_planner()
|
2022-05-08 15:26:15 +02:00
|
|
|
print("Event log housekeeping")
|
2022-05-01 19:57:16 +02:00
|
|
|
db.housekeep_event_log()
|
|
|
|
|
|
|
|
|
|
print("Done")
|