-
Notifications
You must be signed in to change notification settings - Fork 354
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
Threading race condition bugfix for optimize_snr in pycbc_live #4342
Conversation
8deb002
to
4991669
Compare
Is there any appetite for putting a comment in
|
Seems like we could now use the MDC to test this, at least for a short time, given that it served its pre-O4 review purpose. |
d03c9f0
to
de6f2d9
Compare
Note that as Xan is away at the moment, I will be working on this as well, so can no longer review! |
I plan to finally look into this next week. |
Poke on this |
Poke on this - this would be good to get in soon(ish) |
@titodalcanton - is this in the pycbc live testing environment at the moment? |
No, only stuff on master is being tested on the MDC. This is now (again) near the top of my priority list. |
bin/pycbc_live
Outdated
# Give this a nominal value, it is requried but not used | ||
self.fu_cores = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: requried -> required. Also, there should probably be a if self.fu_cores is not None
condition down below in setup_optimize_snr
where fu_cores
is used, otherwise I do not think the resulting command (--cores None
) would be valid.
a15b0f4
to
5e53355
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no more comments, let's merge this and get it running on the MDC.
…ro#4342) * setup snr_opt before threading * Some minor tweaks, setup optimize_snr even if not performing it * Dont open file unless using it * TDC comments * clarify comments * bug --------- Co-authored-by: GarethCabournDavies <[email protected]>
…ro#4342) * setup snr_opt before threading * Some minor tweaks, setup optimize_snr even if not performing it * Dont open file unless using it * TDC comments * clarify comments * bug --------- Co-authored-by: GarethCabournDavies <[email protected]>
…ro#4342) * setup snr_opt before threading * Some minor tweaks, setup optimize_snr even if not performing it * Dont open file unless using it * TDC comments * clarify comments * bug --------- Co-authored-by: GarethCabournDavies <[email protected]>
…ro#4342) * setup snr_opt before threading * Some minor tweaks, setup optimize_snr even if not performing it * Dont open file unless using it * TDC comments * clarify comments * bug --------- Co-authored-by: GarethCabournDavies <[email protected]>
Problem:
There was a potential race condition in
bin/pycbc_live
where:optimize_snr_checks == True
,the main thread could have moved the analysis chunk on before the
setup_optimize_snr
function re-reads some data from self - theevent
class instance,. This causes lines like this:curr_data = self.data_readers[ifo].overwhitened_data(delta_f)
to potentially read the wrong data.Solution:
Split the
setup_optimize_snr
function, which normally accesses/modifies data inevent
, into two functions:setup_optimize_snr
andrun_optimize_snr
. Thesetup
function reads and saves all the data in the main thread before any GraceDB uploads or optimizing ensuring the correct data is saved before the main thread moves the analysis on. It returns the command to be run as a subprocess and the output directory. Therun
function takes these as inputs and runs after the event is uploaded.One extra modification I had to include is because the
setup_optimize_snr
function was dependent on thegid
from GraceDB, therun_optimize_snr
function has to re-open and close the attributes hdf to add thegid
in.Happy for any suggestions/modifications. This is the best idea I've had since I found this was happening.