Commit d5dc42f1 authored by Jonathan Michalon's avatar Jonathan Michalon
Browse files

Print the traceback if something is raised during a ThreadPool run

Since we never reclaim finished tasks, exceptions raised during thread
run are never seen. Add a runner call in between to display them.
parent 234942a6
......@@ -12,6 +12,7 @@ import concurrent.futures
import signal
import argparse
import logging
import traceback
import sys
import os
from time import sleep
......@@ -113,10 +114,10 @@ def run():
# do the actual polling
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
def runner(check):
return, check
def runner(check):
return, check
futures = []
for check in config.checks:
futures.append(executor.submit(runner, check))
......@@ -129,10 +130,19 @@ def run():
print("Check %s failed:\n%s" %
(str(check), check.errmsg.strip()))
# Since we never reclaim finished tasks, exceptions raised during
# run are never seen. Using a runner we can at least display them.
def runner(check):
except Exception as e:
raise e
# This will drift slowly as it takes (base_tick + espilon) seconds
while True:
for check in config.checks:
executor.submit(runner, check)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment