Skip to content

Commit

Permalink
Use timeout=0.1 when clearing task_queue to make sure it doesn't hang.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed Oct 12, 2023
1 parent e1991a0 commit e163f72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion galsim/config/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ def worker(task_queue, results_queue, config, logger, initializers, initargs):
logger.error("%s",traceback.format_exc())
# Clear any unclaimed jobs that are still in the queue
while not task_queue.empty():
task_queue.get()
task_queue.get(timeout=0.1)
# And terminate any jobs that might still be running.
for j in range(nproc):
p_list[j].terminate()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ def test_timeout():
# (PyPy doesn't seem to timeout, so skip this on PyPy.)
if platform.python_implementation() != 'PyPy':
config2 = galsim.config.CleanConfig(config2)
config2['output']['timeout'] = 0.001
config2['output']['timeout'] = 0.0001
with CaptureLog() as cl:
with assert_raises(galsim.GalSimError):
galsim.config.Process(config2, logger=cl.logger)
Expand Down

0 comments on commit e163f72

Please sign in to comment.