def Terminate(): import os import FrameworkSupport if FrameworkSupport.PID: import ALPSPlatform import ALPSDebug ALPSDebug.alps_print("WSDT Framework Terminated") if ALPSPlatform.os_system == ALPSPlatform.OS_WINDOWS: os.system("taskkill /T /F /PID %d" % FrameworkSupport.PID) elif ALPSPlatform.os_system == ALPSPlatform.OS_LINUX: os.system("kill -9 -%d" % FrameworkSupport.PID)
def __connection_attempt_thread(self): def send_func(packet): self.tcp_client.send(packet) while True: time.sleep(5) try: self.tcp_client.connect("Distributor TCP Client Thread", error_except=False) break except: ALPSDebug.alps_print(ALPSDebug.LEVEL.WARN, 'Distributor TCP Client failed to connect to server(%s:%s).' % (self.tcp_client.ip_string, self.tcp_client.port), 'Try again later.') self.connection_append(self, (self.tcp_client.ip_string, self.tcp_client.port), lambda packet:self.tcp_client.send(packet) )
def __output(cls, *args): if args: ALPSDebug.alps_print(level, msg % args) else: ALPSDebug.alps_print(level, msg)