added Pool.join to allow threads to exit safely

added keyboard interrupt signal ignore in threads


Former-commit-id: 836e9ca6be
This commit is contained in:
Arthur Lu 2021-07-16 06:12:26 +00:00
parent 3c7262498c
commit 7e800c9004
2 changed files with 5 additions and 0 deletions

View File

@ -4,8 +4,12 @@ from tra_analysis import Analysis as an
from dataset import push_metric
from data import pull_new_tba_matches
import signal
def simplestats(data_test):
signal.signal(signal.SIGINT, signal.SIG_IGN)
data = np.array(data_test[0])
data = data[np.isfinite(data)]
ranges = list(range(len(data)))

View File

@ -357,6 +357,7 @@ def main():
log(stdout, INF, "detected KeyboardInterrupt, killing threads")
if "exec_threads" in locals():
exec_threads.terminate()
exec_threads.join()
exec_threads.close()
log(stdout, INF, "terminated threads, exiting")
loop_stored_exception = sys.exc_info()