mirror of
https://github.com/zebrajr/pytorch.git
synced 2026-01-15 12:15:51 +00:00
Fix unbound local when an error occurs before pool is initialized (#156750)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156750 Approved by: https://github.com/jamesjwu
This commit is contained in:
committed by
PyTorch MergeBot
parent
bbb930aba2
commit
edf7bb4f51
@@ -1859,6 +1859,7 @@ def run_tests(
|
||||
"If running on CI, add the 'keep-going' label to your PR and rerun your jobs."
|
||||
)
|
||||
|
||||
pool = None
|
||||
try:
|
||||
for test in selected_tests_serial:
|
||||
options_clone = copy.deepcopy(options)
|
||||
@@ -1921,8 +1922,9 @@ def run_tests(
|
||||
del os.environ["NUM_PARALLEL_PROCS"]
|
||||
|
||||
finally:
|
||||
pool.terminate()
|
||||
pool.join()
|
||||
if pool:
|
||||
pool.terminate()
|
||||
pool.join()
|
||||
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user