Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make multiprocessing Pool safe in quickquasars #570

Merged
merged 2 commits into from Oct 26, 2022
Merged

Make multiprocessing Pool safe in quickquasars #570

merged 2 commits into from Oct 26, 2022

Conversation

andreicuceu
Copy link
Contributor

The best practice for using multiprocessing.Pool is within a "with as" statement to safely terminate the pool.

We (with Naim) found a bug when nproc > nfiles. This is the error message at the end of running quickquasars:

Exception ignored in: <function Pool.del at 0x1555439bcf70>
Traceback (most recent call last):
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/pool.py", line 268, in del self._change_notifier.put(None)
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/queues.py", line 378, in put self._writer.send_bytes(obj)
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/connection.py", line 205, in send_bytes self._send_bytes(m[offset:offset + size])
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/connection.py", line 416, in _send_bytes self._send(header + buf)
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/connection.py", line 373, in _send n = write(self._handle, buf)
OSError: [Errno 9] Bad file descriptor

This goes away when using "with multiprocessing.Pool(args.nproc) as pool:" to clean the pool after it's used.

The best practice for using multiprocessing.Pool is within a "with as" statement to safely terminate the pool.

We (with Naim) found a bug when nproc > nfiles. This is the error message at the end of running quickquasars:

Exception ignored in: <function Pool.del at 0x1555439bcf70>
Traceback (most recent call last):
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/pool.py", line 268, in del
self._change_notifier.put(None)
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/queues.py", line 378, in put
self._writer.send_bytes(obj)
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/connection.py", line 205, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/connection.py", line 416, in _send_bytes
self._send(header + buf)
File "/global/homes/a/acuceu/.conda/envs/desienv/lib/python3.9/multiprocessing/connection.py", line 373, in _send
n = write(self._handle, buf)
OSError: [Errno 9] Bad file descriptor

This goes away when using "with multiprocessing.Pool(args.nproc) as pool:" to clean the pool after it's used.
@alxogm
Copy link
Contributor

alxogm commented Oct 24, 2022

Tests keeps failing, so I wonder if the issue is that the workflow file is referring to the master branch instead of the main?

DESISIM_TESTDATA_VERSION: master

@sbailey should we modify the python-package.yml file?

@sbailey
Copy link
Contributor

sbailey commented Oct 24, 2022

@alxogm @andreicuceu yes, please update master -> main references, both in .github/workflows/python-package.yml and in the top level requirements.txt file.

@alxogm
Copy link
Contributor

alxogm commented Oct 26, 2022

Again one of the test failed but is unrelated to this PR or desisim, since is the same case as the last PR by Hiram, I think @andreicuceu you can merge to master.

@andreicuceu
Copy link
Contributor Author

Hi @alxogm, you have to do the merge, as I don't have permissions.

@alxogm alxogm merged commit 6f50776 into desihub:main Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants