98 Clean or hard shutdown of all processes.
99 It tries to kill the process gracefully but if it does not react after a certain time,
100 it kills it with a SIGKILL.
103 basf2.B2WARNING(
"Signal handler called without started process. This normally means, something is wrong!")
106 basf2.B2INFO(
"Termination requested...")
109 signal.signal(signal.SIGINT, signal.SIG_IGN)
110 signal.signal(signal.SIGTERM, signal.SIG_IGN)
116 os.killpg(process.pid, signal.SIGINT)
118 except ProcessLookupError:
124 basf2.B2WARNING(
"Process did not react in time. Sending a SIGKILL.")
129 os.killpg(process.pid, signal.SIGKILL)
131 backtrace = subprocess.check_output([
"gdb",
"-q",
"-batch",
"-ex",
"backtrace",
"basf2",
132 str(process.pid)]).decode()
133 basf2.B2ERROR(
"Could not end the process event with a KILL signal. "
134 "This can happen because it is in the uninterruptable sleep state. "
135 "I can not do anything about this!",
137 except ProcessLookupError:
140 basf2.B2INFO(
"...Process stopped")