added Pool.join to allow threads to exit safely

added keyboard interrupt signal ignore in threads
This commit is contained in:
Arthur Lu 2021-07-16 06:12:26 +00:00
parent 246efd524b
commit 836e9ca6be
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()