self.ioThread.daemon=True# thread dies with the program
self.ioThread=threading.Thread(
target=self.svcOutputReader,args=(
self.subProcess.stdout,self.ipcQueue))
self.ioThread.daemon=True# thread dies with the program
self.ioThread.start()
self.shouldStop=False# don't let the main loop stop
self.shouldStop=False# don't let the main loop stop
self.status=MainExec.STATUS_STARTING
# wait for service to start
foriinrange(0,10):
foriinrange(0,10):
time.sleep(1.0)
self._procIpcBatch()# pump messages
self._procIpcBatch()# pump messages
print("_zz_",end="",flush=True)
ifself.status==MainExec.STATUS_RUNNING:
ifself.status==MainExec.STATUS_RUNNING:
print("TDengine service READY to process requests")
return# now we've started
raiseRuntimeError("TDengine service did not start successfully")# TODO: handle this better?
return# now we've started
# TODO: handle this better?
raiseRuntimeError("TDengine service did not start successfully")
defstopTaosService(self):
# can be called from both main thread or signal handler
print("Terminating TDengine service running as the sub process...")
# Linux will send Control-C generated SIGINT to the TDengine process already, ref: https://unix.stackexchange.com/questions/176235/fork-and-how-signals-are-delivered-to-processes
ifnotself.subProcess:
# Linux will send Control-C generated SIGINT to the TDengine process