From 5a6e97e17a59ea63588891ff5fa780d0d7ee34cc Mon Sep 17 00:00:00 2001
From: stedif <stefano.difrischia@inaf.it>
Date: Wed, 15 Sep 2021 16:24:14 +0200
Subject: [PATCH] L2SS-235: add exception catching if containers are offline

---
 devices/toolkit/archiver.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/devices/toolkit/archiver.py b/devices/toolkit/archiver.py
index 1ec7f642b..fe3b1f87d 100644
--- a/devices/toolkit/archiver.py
+++ b/devices/toolkit/archiver.py
@@ -18,6 +18,15 @@ class Archiver():
     def __init__(self, cm_name: str = 'archiving/hdbpp/confmanager01', es_name: str = 'archiving/hdbpp/eventsubscriber01', context: str = 'RUN'):
         self.cm_name = cm_name
         self.cm = DeviceProxy(cm_name)
+        try: 
+            cm_state = self.cm.state() # ping the device server
+            if cm_state is 'FAULT':
+                print('Configuration Manager is in FAULT state')
+                print(self.cm.status())
+                return
+        except:
+            print(traceback.format_exc())
+            return
         self.es_name = es_name
         self.es = DeviceProxy(es_name)
         self.cm.write_attribute('Context',context)    # Set default Context Archiving for all the subscribers
@@ -195,7 +204,7 @@ class Archiver():
                 return errs_dict.get(e)
         return None
     
-    def get_subscriber_load(self,use_freq=True,es_name:str = None):
+    def get_subscriber_load(self,use_freq:bool=True,es_name:str = None):
         """
         Return the estimated load of an archiver, in frequency of records or number
         of attributes
-- 
GitLab