SNEWS2 / snewpy

A Python package for working with supernova neutrinos
https://snewpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
26 stars 19 forks source link

asyncio fixes under Python 3.7 #156

Closed JostMigenda closed 2 years ago

JostMigenda commented 2 years ago

This PR is intended to fix #155.

As discussed there, it only fixes the first part currently, so I’ll keep it as a draft.

github-actions[bot] commented 2 years ago

Result of Benchmark Tests

Benchmark Min Max Mean
python/snewpy/test/test_snowglobes.py::test_simulation_chain_benchmark 5.32 5.44 5.37 +- 0.06
Sheshuk commented 2 years ago
Uh, so the time increased by 1 second. Here's a comparison from one of the previous runs: Benchmark Min Max Mean
python/snewpy/test/test_snowglobes.py::test_simulation_chain_benchmark 4.34 4.46 4.40 +- 0.05
Sheshuk commented 2 years ago

So we're having slightly decreased productivity because of the overhead of spawning threads wrt asyncio callbacks. But I think it's ok for now - it still is much more performant than it used to be, and we keep the code clean (without trying to hack around the Watchers in python 3.7). Also the snowglobes_interface will have to be updated when SNOwGLoBES v1.3 is out, probably we'll have more abilities to parallelize the jobs.

JostMigenda commented 2 years ago

This looks good; thank you!

By the time SNOwGLoBES v1.3 is out, I think it’ll probably be okay to drop Python 3.7 support so we’ll have a bit more freedom then to choose the best path forward.