cta-observatory / cta-lstchain

LST prototype testbench chain
https://cta-observatory.github.io/cta-lstchain/
BSD 3-Clause "New" or "Revised" License
26 stars 77 forks source link

Close EventSource instances #1316

Closed moralejo closed 1 week ago

moralejo commented 1 week ago

Avoid a lot of zombie processes when using these functions repeatedly

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 93.42105% with 5 lines in your changes missing coverage. Please review.

Project coverage is 73.50%. Comparing base (9bab172) to head (bc7b13e). Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lstchain/image/modifier.py 93.42% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1316 +/- ## ======================================= Coverage 73.50% 73.50% ======================================= Files 134 134 Lines 14211 14211 ======================================= Hits 10446 10446 Misses 3765 3765 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

maxnoe commented 1 week ago

better directly use the context manager:

with EventSource(...) as mc_reader:
    ...
moralejo commented 1 week ago

I hope I didn't mess ups with the indents... I wonder if it was really worth. I will check again later, back to Draft