From 40d96230d239477e90fc3ac8b82a07544a09b96d Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Sun, 1 May 2022 20:27:19 +0200 Subject: [PATCH] Adjust planner times from runner. Fixes #167. --- bin/datastore.py | 15 +++++++++++++++ bin/housekeep_database.py | 1 + 2 files changed, 16 insertions(+) diff --git a/bin/datastore.py b/bin/datastore.py index 2ec5b3a..cb1f52e 100644 --- a/bin/datastore.py +++ b/bin/datastore.py @@ -679,6 +679,21 @@ class Datastore: # We do not commit if we've been passed a cursor, instead # we assume that we are in the middle of a transaction + def adjust_planner(self, cursor = None): + """ + Adjust estimated times on the planner + """ + if cursor is None: + cur = self.conn.cursor() + else: + cur = cursor + + qry = "CALL adjust_planner();" + cur.execute(qry) + if cursor is None: + self.maybe_commit() + # We do not commit if we've been passed a cursor, instead + # we assume that we are in the middle of a transaction def housekeep_event_log(self, cursor = None): """ diff --git a/bin/housekeep_database.py b/bin/housekeep_database.py index 46f5af0..5b1fc4c 100755 --- a/bin/housekeep_database.py +++ b/bin/housekeep_database.py @@ -20,6 +20,7 @@ if __name__ == '__main__': print(f'Survey: {survey["id"]} ({survey["schema"]})') db.set_survey(survey["schema"]) + db.adjust_planner() db.housekeep_event_log() print("Done")