From 6d18a50fadb2a66c971702d64de968128222f431 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Fri, 04 May 2018 23:31:22 +0000
Subject: [PATCH] Merge branch 'master' of ssh://git.penic.eu:29418/trisurf-client
---
tsclient.py | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/tsclient.py b/tsclient.py
index 972fd81..693d51b 100755
--- a/tsclient.py
+++ b/tsclient.py
@@ -72,6 +72,14 @@
else:
raise ValueError
+def send_error_report(addr,cid, rid,errcode):
+ client_data={'client_id':cid, 'run_id':rid, 'error_code':errcode}
+ response=requests.post(addr+"/api/reporterr/", data=client_data)
+ if(response.status_code==200):
+ return
+ else:
+ raise ValueError
+
def upload(addr,cid, rid, vtu, status):
client_data={'client_id': cid, 'run_id': rid, 'lastVTU': vtu, 'status': status}
response=requests.post(addr+"/api/upload/", data=client_data)
@@ -162,7 +170,12 @@
#check if trisurf is still running. If not break the highest level loop.
sleep(1)
if(p.poll() is not None): # trisurf exited!
- print("Trisurf was stopped")
+ print("Trisurf was stopped with return code {}".format(p.returncode))
+ if(p.returncode!=0):
+ try:
+ send_error_report(CONNECT_ADDR, cid, rid, p.returncode)
+ except:
+ print("Server didn't accept error report")
removeDir(workingdir.fullpath())
break
sleep(100)
--
Gitblit v1.8.0