Commit 48bbe9bd authored by Dainius Simelevicius's avatar Dainius Simelevicius
Browse files

references #187: made hotspotmailer.py more robust

parent 9f677d1c
......@@ -17,11 +17,11 @@
// !!! Edit this line to reflect the latest package version !!!
#define WORKSUITE_SENTINELUTILS_VERSION_MAJOR 2
#define WORKSUITE_SENTINELUTILS_VERSION_MINOR 3
#define WORKSUITE_SENTINELUTILS_VERSION_MINOR 4
#define WORKSUITE_SENTINELUTILS_VERSION_PATCH 0
// If any previous versions available E.g. #define WORKSUITE_SENTINELUTILS_PREVIOUS_VERSIONS "3.8.0,3.8.1"
#undef WORKSUITE_SENTINELUTILS_PREVIOUS_VERSIONS
#define WORKSUITE_SENTINELUTILS_PREVIOUS_VERSIONS "2.2.0"
#define WORKSUITE_SENTINELUTILS_PREVIOUS_VERSIONS "2.2.0,2.3.0"
//
......
......@@ -44,16 +44,22 @@ zone = sys.argv[2]
print("spotlightUrl = " + sys.argv[1])
print
connection = http.client.HTTPConnection(spotlightUrl)
#connection.set_debuglevel(1)
connection.request('GET', '/urn:xdaq-application:service=sentinelspotlight2g/lastStoredEvents')
response = connection.getresponse()
result = response.read().decode()
if (response.status != 200):
print("response.status = " + response.status, "response.reason = " + response.reason)
exit()
connection.close()
succeded = False
while not succeded:
try:
connection = http.client.HTTPConnection(spotlightUrl)
connection.request('GET', '/urn:xdaq-application:service=sentinelspotlight2g/lastStoredEvents')
response = connection.getresponse()
result = response.read().decode()
if (response.status != 200):
print("response.status = " + response.status, "response.reason = " + response.reason)
exit()
connection.close()
succeded = True
except:
connection.close()
time.sleep(10)
print("Server is down retrying...")
events = json.loads(result)
lastStoreTime = events["lastStoreTime"]
......@@ -65,14 +71,22 @@ egroup_address = "cms-os-forward-" + zone + "@cern.ch"
severity_icons = {"fatal": "🟥", "error": "🟧", "warning": "🟨"}
while 1:
connection.request('GET', '/urn:xdaq-application:service=sentinelspotlight2g/lastStoredEvents?start=' + lastStoreTime)
response = connection.getresponse()
result = response.read().decode()
if (response.status != 200):
print("response.status = " + response.status, "response.reason = " + response.reason)
exit()
connection.close()
succeded = False
while not succeded:
try:
connection.request('GET', '/urn:xdaq-application:service=sentinelspotlight2g/lastStoredEvents?start=' + lastStoreTime)
response = connection.getresponse()
result = response.read().decode()
if (response.status != 200):
print("response.status = " + response.status, "response.reason = " + response.reason)
exit()
connection.close()
succeded = True
except:
connection.close()
time.sleep(10)
print("Server is down retrying...")
events = json.loads(result)
lastStoreTime = events["lastStoreTime"]
print("lastStoreTime = '" + lastStoreTime + "'")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment