From 63aabbe62885e8b4677a7407ed32f478abd0b0e8 Mon Sep 17 00:00:00 2001 From: Emanuele Laface <ema@morla.esss.lu.se> Date: Wed, 11 Mar 2020 14:22:09 +0100 Subject: [PATCH] Added a print when the main thread of the screens crashes --- PythonServer/screens/contacts.py | 4 +++- PythonServer/screens/instruments.py | 4 +++- PythonServer/screens/interlocks.py | 4 +++- PythonServer/screens/pos.py | 4 +++- PythonServer/screens/ts2_cav.py | 4 +++- PythonServer/screens/ts2_screens.py | 4 +++- PythonServer/screens/ts2_tpcircuits.py | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/PythonServer/screens/contacts.py b/PythonServer/screens/contacts.py index 632097a..eef1fe6 100755 --- a/PythonServer/screens/contacts.py +++ b/PythonServer/screens/contacts.py @@ -2,6 +2,7 @@ import epics import json import time import os +import sys import matplotlib.pyplot as plt from numpy import linspace, zeros from threading import Thread @@ -47,7 +48,8 @@ class contactsScreen(Thread): with open('/var/www/data/contacts.json','w') as datafile: # Write the final file datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) # Refresh every half a second for pv in epics_dict: # When the stop signal is set, it cancels all the auto monitor and disconnects diff --git a/PythonServer/screens/instruments.py b/PythonServer/screens/instruments.py index d1878c3..51810f8 100755 --- a/PythonServer/screens/instruments.py +++ b/PythonServer/screens/instruments.py @@ -2,6 +2,7 @@ import epics import json import time import os +import sys import matplotlib.pyplot as plt from numpy import linspace, zeros, tile from threading import Thread @@ -193,7 +194,8 @@ class instrumentsScreen(Thread): datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) for pv in epics_dict: diff --git a/PythonServer/screens/interlocks.py b/PythonServer/screens/interlocks.py index 82da388..11047f5 100755 --- a/PythonServer/screens/interlocks.py +++ b/PythonServer/screens/interlocks.py @@ -1,6 +1,7 @@ import epics import json import time +import sys from threading import Thread class interlocksScreen(Thread): @@ -38,7 +39,8 @@ class interlocksScreen(Thread): with open('/var/www/data/interlocks.json','w') as datafile: datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) for pv in epics_dict: diff --git a/PythonServer/screens/pos.py b/PythonServer/screens/pos.py index 765b5c7..0542617 100755 --- a/PythonServer/screens/pos.py +++ b/PythonServer/screens/pos.py @@ -1,6 +1,7 @@ import epics import json import time +import sys from numpy import linspace from threading import Thread @@ -79,7 +80,8 @@ class posScreen(Thread): with open('/var/www/data/pos.json','w') as datafile: datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) for pv in epics_dict: diff --git a/PythonServer/screens/ts2_cav.py b/PythonServer/screens/ts2_cav.py index 88e6e1f..a0d6700 100755 --- a/PythonServer/screens/ts2_cav.py +++ b/PythonServer/screens/ts2_cav.py @@ -1,6 +1,7 @@ import epics import json import time +import sys from threading import Thread class ts2_cavScreen(Thread): @@ -39,7 +40,8 @@ class ts2_cavScreen(Thread): datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) for pv in epics_dict: diff --git a/PythonServer/screens/ts2_screens.py b/PythonServer/screens/ts2_screens.py index 6850c93..8308549 100755 --- a/PythonServer/screens/ts2_screens.py +++ b/PythonServer/screens/ts2_screens.py @@ -1,6 +1,7 @@ import epics import json import time +import sys from threading import Thread class ts2_screensScreen(Thread): @@ -38,7 +39,8 @@ class ts2_screensScreen(Thread): with open('/var/www/data/ts2_screens.json','w') as datafile: datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) for pv in epics_dict: diff --git a/PythonServer/screens/ts2_tpcircuits.py b/PythonServer/screens/ts2_tpcircuits.py index d369acc..c2a5203 100755 --- a/PythonServer/screens/ts2_tpcircuits.py +++ b/PythonServer/screens/ts2_tpcircuits.py @@ -1,6 +1,7 @@ import epics import json import time +import sys from threading import Thread class ts2_tpcircuitsScreen(Thread): @@ -38,7 +39,8 @@ class ts2_tpcircuitsScreen(Thread): with open('/var/www/data/ts2_tpcircuits.json','w') as datafile: datafile.write(tmp_json) except: - continue + print(sys.exc_info()) + time.sleep(1) time.sleep(0.5) for pv in epics_dict: -- GitLab