1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 02:34:18 +00:00

handle failed job exception

This commit is contained in:
deadc0de6
2023-01-20 17:04:28 +01:00
parent a5d74cf46d
commit 5044aee2b4

View File

@@ -83,19 +83,24 @@ def main():
spinner = Halo(text='Testing', spinner='bouncingBall') spinner = Halo(text='Testing', spinner='bouncingBall')
spinner.start() spinner.start()
with futures.ThreadPoolExecutor(max_workers=max_jobs) as ex: with futures.ThreadPoolExecutor(max_workers=max_jobs) as ex:
wait_for = [] wait_for = {}
for test in tests: for test in tests:
j = ex.submit(run_test, logfd, test) j = ex.submit(run_test, logfd, test)
wait_for.append(j) wait_for[j] = test
logfd.flush() logfd.flush()
for test in futures.as_completed(wait_for): for test in futures.as_completed(wait_for.keys()):
ret, reason, name, log = test.result() try:
logfd.flush() ret, reason, name, log = test.result()
except Exception as exc:
print()
print(f'test \"{wait_for[test]}\" failed: {exc}')
logfd.close()
return False
if not ret: if not ret:
ex.shutdown(wait=False) ex.shutdown(wait=False)
for remainer in wait_for: for job in wait_for:
remainer.cancel() job.cancel()
print() print()
print(log) print(log)
print(f'test \"{name}\" failed: {reason}') print(f'test \"{name}\" failed: {reason}')