Samo Penic
2018-05-05 eccf3a5f7218be8d6a10dbdc5a8202c26341c75f
tsclient.py
@@ -60,12 +60,21 @@
      status=client_data['status']
      return (rid,tape,vtu,status)
   else:
      print(response.text)
      raise ValueError
def ping_run(addr,cid, rid):
   client_data={'client_id':cid, 'run_id':rid}
   response=requests.post(addr+"/api/ping/", data=client_data)
   if(response.status_code==200):
      return
   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:
@@ -161,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)