Samo Penic
2018-06-27 8058abbda761b70a9cad31df63fcde499713991c
Fixed issue when subruns didn't report it's trisurf version
1 files modified
10 ■■■■ changed files
tsclient.py 10 ●●●● patch | view | raw | blame | history
tsclient.py
@@ -12,6 +12,10 @@
from threading import Thread, Event
import re
glob_ts_version='00000'
def getTrisurfVersion():
    p = subprocess.Popen('trisurf --version', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    lines=p.stdout.readlines()
@@ -29,7 +33,8 @@
    return ((([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")] or [[(s.connect(("8.8.8.8", 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) + ["no IP found"])[0])
def get_client_id(addr, my_ip, my_hostname, subrun):
    client_auth={'ip':my_ip,'hostname':my_hostname, 'subrun':subrun, 'trisurf_version':getTrisurfVersion() }
    global glob_ts_version
    client_auth={'ip':my_ip,'hostname':my_hostname, 'subrun':subrun, 'trisurf_version':glob_ts_version }
    response=requests.post(addr+"/api/register/", data=client_auth)
    if(response.status_code==200):
        client_data=json.loads(response.text)
@@ -349,7 +354,8 @@
#--- END SIGINT and SIGTERM----
if __name__ == '__main__':
    #global glob_ts_version
    glob_ts_version=getTrisurfVersion()
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)