Skip to content

move metadata / event pushing in HTTPSpooler into doStopLog#850

Closed
barentine wants to merge 1 commit into
python-microscopy:masterfrom
barentine:httpev
Closed

move metadata / event pushing in HTTPSpooler into doStopLog#850
barentine wants to merge 1 commit into
python-microscopy:masterfrom
barentine:httpev

Conversation

@barentine
Copy link
Copy Markdown
Member

@barentine barentine commented Feb 12, 2021

Addresses issue race condition mentioned in #822 .

Proposed changes:

  • move metadata and events put into doStopLog. This moves them into Spooler.StopSpool rather than after, but importantly puts them after disconnecting from frame source, after protocol.finish() which can still generate events, but before self.spoolOn = False.

Checklist:

  • Tested

@barentine
Copy link
Copy Markdown
Member Author

note that this also avoids the events/rule pushing race condition I ran into without any clusterpzfdatasource special casing

@David-Baddeley
Copy link
Copy Markdown
Contributor

Unfortunately this might not work as intended as the existence of final_metadata.json / events.json is used in pushers to confirm whether spooling is complete (and, by inference, is assumed to occur after all the frames have been pushed).

Hard to be 100% certain if this will cause any issues, but there is a small chance that it will give rise to yet another race condition down the track. It might be safer to leave writing these files where it is and add a new spool_complete flag to check in the return from StartSpooling() instead. Will see if I can quickly pull together an alternative.

@barentine
Copy link
Copy Markdown
Member Author

ah, I see your point. I do kind of think this is still the right place to push the events/metadata though, and wonder if it should just be combined with a spool_complete signal for the pushers to connect?

@David-Baddeley
Copy link
Copy Markdown
Contributor

David-Baddeley commented Feb 16, 2021

making the pushers aware of the spooler completion (rather than relying on file existence checks) is on the TODO list, and would be nice, but will only ever work for pushers which are in-process - and not for pushers which are running elsewhere - e.g. triggered from ClusterUI, or from the ruleserver, e.g., with a rule that monitors directories for changes (If you notice the rule structure, IntegerIDRule is currently the only rule type implemented on the ruleserver, but it derives from a Rule base class for a reason- the long term plan has always been to add GLOB based rules - i.e. generate tasks for all files matching this pattern - as well).

@barentine
Copy link
Copy Markdown
Member Author

barentine commented Feb 16, 2021

I guess I don't see how we're answering anything other than in-process pushers right now? A non in-process pusher e.g. on clusterUI will still check for the events file

--edit-- sorry, this was completely missing your last point. I'm there now!

@David-Baddeley
Copy link
Copy Markdown
Contributor

David-Baddeley commented Feb 16, 2021 via email

@David-Baddeley
Copy link
Copy Markdown
Contributor

Closing as issue addressed in #857 in a slightly safer / more paranoid way

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.

2 participants