From e74a4de2f54b3b0647228550d1d529b0211b4ddf Mon Sep 17 00:00:00 2001
From: Jonas <jonas@holm.tech>
Date: Mon, 15 Apr 2019 12:57:23 +0200
Subject: [PATCH] WIP: Publish of Double to IS working

---
 Script/cs/Threads/InfoServiceThread.py | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/Script/cs/Threads/InfoServiceThread.py b/Script/cs/Threads/InfoServiceThread.py
index c88e571..92752a5 100644
--- a/Script/cs/Threads/InfoServiceThread.py
+++ b/Script/cs/Threads/InfoServiceThread.py
@@ -63,20 +63,22 @@ class InfoServiceThread(threading.Thread):
 
     def send_update(self):
         try:
-            self.logger.debug("Getting state from IS")
+            is_data_type = "Double"
+            is_data_identifier = "RunParams.{}.State".format(self.tdaq_app_name)
+            self.logger.debug("Retrieving: {}, type: {}, from IS".format(is_data_identifier,is_data_type))
 
-            # Note that we have to specify the type here
-            cs_state = ISObject(self.ipc_partition,"RunParams.{}.State".format(self.tdaq_app_name), 'CastorScriptState')
+            is_data = ispy.ISObject(self.ipc_partition, is_data_identifier, is_data_type)
 
-            if cs_state.exists():
-                cs_state.checkout()
-                print cs_state
+            if is_data.exists():
+                is_data.checkout()
+                print("found: {}".format(is_data))
             else:
-                print(cs_state.name() + " does not exist")
+                print(is_data.name() + " does not exist")
 
-            cs_state.uptime_seconds = self.uptime_seconds
-            cs_state.checkin()
+            is_data.value = self.uptime_seconds
+            is_data.checkin()
 
-            self.logger.debug("Update sent: %s", str(cs_state))
+            self.logger.debug("Update sent: %s", str(is_data))
+            self.logger.info("TEST   Update sent: %s", str(is_data))
         except Exception as ex:
-            self.logger.warning("Error occured while trying to change cs_state to tdaq_app_name=%s uptime_seconds=%d. Error was: %s",self.tdaq_app_name, self.uptime_seconds, str(ex))
+            self.logger.warning("Error occured while trying to change is_data to uptime_seconds=%d. Error was: %s", self.uptime_seconds, str(ex))
-- 
GitLab