Samo Penic
2018-05-05 eccf3a5f7218be8d6a10dbdc5a8202c26341c75f
Playground with threaded run
1 files modified
28 ■■■■ changed files
playground/tsclient.py 28 ●●●● patch | view | raw | blame | history
playground/tsclient.py
@@ -4,34 +4,12 @@
from time import sleep
import uuid
import subprocess
#from trisurf import trisurf
import os
import shutil
import signal
import sys
import socket
from threading import Thread, Event
"""
p=None
workingdir=None
#--- SIGINT and SIGTERM HANDLING ---
def signal_handler(signal,frame):
    global p
    global wirkingdir
    if p is not None:
        p.terminate()
    if(workingdir is not None):
        removeDir(workingdir.fullpath())
    print("Process ended with signal " +str(signal))
    sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
#--- END SIGINT and SIGTERM----
"""
def get_hostname():
    return socket.gethostname()
@@ -119,7 +97,8 @@
        self.id=subid
        self.ip=get_ip()
        self.hostname=get_hostname()
        self.update_seconds=update_seconds
        self.update_seconds=update_second
#        self.subthreads=[]
    def stop(self):
        self._stop_event.set()
@@ -291,13 +270,12 @@
#--- SIGINT and SIGTERM HANDLING ---
def signal_handler(signal,frame):
    t.stop()
    t.join()
    print("Process ended with signal " +str(signal))
    sys.exit(0)
    sys.exit(signal)
#--- END SIGINT and SIGTERM----
if __name__ == '__main__':