From 96035d56405636108935775cb15df309972443fc Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 5 Jan 2022 11:13:09 +0100
Subject: [PATCH] L2SS-555: Merge common initialisation code and add required
 properties to abstract base class already.

---
 .../tangostationcontrol/toolkit/retriever.py         | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tangostationcontrol/tangostationcontrol/toolkit/retriever.py b/tangostationcontrol/tangostationcontrol/toolkit/retriever.py
index 4a3c0be20..b62c01fcc 100644
--- a/tangostationcontrol/tangostationcontrol/toolkit/retriever.py
+++ b/tangostationcontrol/tangostationcontrol/toolkit/retriever.py
@@ -15,6 +15,10 @@ class Retriever(ABC):
     """
     The Retriever abstract class implements retrieve operations on a given DBMS
     """
+
+    def __init__(self):
+        self.session = self.connect_to_archiving_db()
+        self.ab = self.set_archiver_base()
     
     def create_session(self, creds):
         """
@@ -120,8 +124,8 @@ class RetrieverMySQL(Retriever):
     
     def __init__(self, cm_name: str = 'archiving/hdbpp/confmanager01'):
         self.cm_name = cm_name
-        self.session = self.connect_to_archiving_db()
-        self.ab = self.set_archiver_base()
+
+        super().__init__()
     
     def connect_to_archiving_db(self):
         """
@@ -216,8 +220,8 @@ class RetrieverTimescale(Retriever):
     
     def __init__(self, cm_name: str = 'archiving/hdbppts/confmanager01'):
         self.cm_name = cm_name
-        self.session = self.connect_to_archiving_db()
-        self.ab = self.set_archiver_base()
+
+        super().__init__()
     
     def connect_to_archiving_db(self):
         """
-- 
GitLab