self.shouldStop=False# don't let the main loop stop
self.status=MainExec.STATUS_RUNNING
def_stopTaosService(self):
self.status=MainExec.STATUS_STARTING
# wait for service to start
foriinrange(0,10):
time.sleep(1.0)
self._procIpcBatch()# pump messages
print("_zz_",end="",flush=True)
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?
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
...
...
@@ -1804,7 +1819,7 @@ class SvcManager:
exceptsubprocess.TimeoutExpiredaserr:
print("Time out waiting for TDengine service process to exit")
else:
print("Sub process has ended")
print("TDengine service process terminated successfully from SIG_INT")