Repository navigation
Make the already-updating guard real and keep one pending check per data file - #87
Draft
jwrosewell wants to merge 3 commits into
Draft
jwrosewell wants to merge 3 commits into
jwrosewell wants to merge 3 commits into
Conversation
…ata file An update returns False while another is running for the same data file, with the flag set under a lock, and the flag is cleared when an update ends, however it ends. The pending scheduled check is cancelled before the next is scheduled, so a manual update no longer leaves two chains of checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two defects in
pipeline/fiftyone_pipeline_engines/src/fiftyone_pipeline_engines/datafile_update_service.pyonrc. data-updates.md does not say what happens when an update is asked for while another runs, or how many checks may be pending, so this draft follows the code's own stated intent and the other languages, as below.update_data_filesaid "exit if already updating" and then ranif data_file.updating: pass. The flag was only ever set toFalse, so a manual update and a scheduled one could run at the same time.check_next_updatemade a newthreading.Timerand replaceddata_file.update_timerwithout cancelling the one still pending. A manual update made while a timer was pending left two chains of checks, andunregister_data_filecancelled only the newest.What changed
update_data_filesetsupdatingunder a lock and returnsFalsewhen an update is already running for the data file, as Node'supdateDataFiledoes (dataFileUpdateService.jslines 165 to 172). The flag is cleared in afinally, so an update that raises does not leave the data file blocked. The body moved to_update_data_fileunchanged.check_next_updatecancels the pending check, under the same lock, before it schedules the next one, so a data file has one pending check and polling carries on after a manual update. Unregistering then cancels every check. .NET keeps one timer per data file (DataUpdateService.cslines 236 to 260 andClearTimerat 1229 to 1245), and Java cancels the pending check before it schedules the next (DataUpdateServiceDefault.javalines 236 to 246), so this part matches both.updatingis true. That flag is now set during an update, so a file change during an update is picked up at the next watcher check.For James to decide
Refusing an update while another runs for the same data file. Python's code on
rcsays it means to ("exit if already updating", and the file system watcher's check ofupdating), and Node refuses. Neither .NET (CheckForUpdate,DataUpdateService.cslines 797 to 920) nor Java (checkForUpdate,DataUpdateServiceDefault.javalines 185 to 250) refuses, and both run the two updates. The specification is silent. Dropping the refusal would keep only the single pending check, and would leaveupdatingset by nothing, so its checks would go too.Overlap
This draft's base is
rcand it depends on no other draft. The data update draft #69, which holds the licence key draft #78, changesupdate_data_fileheavily.git merge-treeof this head with #69 and with #78 is clean. #69's newupdate_from_memorysetsupdatingwithout this draft's lock, so whichever of #69 and this draft merges second takes the lock inupdate_from_memorytoo.How it was verified
New tests in
pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_guard.pyuse fake timers and a request that waits, so no thread is left behind.rc: run 42724595757, 4 of 6 fail (one pending check, no overlap, polling carries on, and unregistering).d2f6eae6: run 42724742569, 6 passed.0270803a, which only names the tests' 10 second wait asWAIT_SECONDS: run 42800175939, 6 passed, the update service tests 4 passed, core 354 passed.0270803aa25ef041341421fd4fc87f7f0028c84b: queued, and this line is updated when it finishes.The last release into
mainmerged on 2026-11-04.