Repository navigation
Align the data update service to the specification: HTTP date, expected time, update from memory and logging - #69
Draft
jwrosewell wants to merge 2 commits into
Draft
jwrosewell wants to merge 2 commits into
jwrosewell wants to merge 2 commits into
Conversation
Send If-Modified-Since as an HTTP date, wait for the data update expected time before the first poll, add update_from_memory, and log the actions with the messages and levels in the Logging section of the data updates specification.
… update examples With If-Modified-Since sent as an HTTP date, the Distributor answers 304 when the file is current, which the examples reported as a failure.
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
The data update service differs from the data updates specification in four ways. These are items D1, D2, D4 and D6 of the list of gaps between the pipeline libraries and the specification.
If-Modified-Sinceis sent as2026-11-03T10:30:00Z, which is not an HTTP date, so a server ignores it.get_next_updateexists on every data file but nothing calls it, so polling starts before the time new data is expected.warn, andLogger.logaccepts onlydebug,info,warning,errorandcritical, so that call raisesValueError: list.index(x): x not in listin the update thread (run againstLoggerinpipeline/fiftyone_pipeline_core/src/fiftyone_pipeline_core/logger.py). A connection failure raises out of the update thread as well, so no later check is scheduled.What changed
All changes are in
pipeline/fiftyone_pipeline_engines/src/fiftyone_pipeline_engines/datafile_update_service.py.D1, the header. Update polling says "the
If-Modified-Sinceheader SHOULD be set to the publication date of the existing data file. If the data file does not have a publication date then the file system last modified date/time can be used instead." The value is now written withemail.utils.formatdate(..., usegmt=True), which gives the HTTP date of RFC 9110 section 5.6.7. A published date that cannot be read falls back to the file's last modified time. A data file with neither sends no header.D2, waiting for the expected time. Automatic update via HTTP says "If the current data contains a data update expected timestamp, then polling will not start until after that time."
check_next_updatenow callsget_next_update. When that time is in the future, the next check waits until then plus the random offset, as the .NET service does. Otherwise the polling interval plus the random offset applies as before. A plain date that is not later than today is the default of a data file that does not know, and is ignored.D4, update from memory. Programmatic update says "For memory data sources, programmatic update MUST allow provision of the new memory data source." The new public method
DataFileUpdateService.update_from_memory(data_file, data)is named as in .NET and Java (UpdateFromMemory,updateFromMemory). It refreshes a data file created withdownload=Falsefrom the bytes given, reports the result to theon_completemethods, and returns anUpdateStatus. If the engine cannot use the data, the data it had is kept andAUTO_UPDATE_REFRESH_FAILEDis returned. A data file kept on disk raisesValueError, because a refresh would read the file and ignore the bytes. A data file whose engine has been closed returnsAUTO_UPDATE_NOT_NEEDED.D6, logging. The Logging section says "All major actions SHOULD be logged at the appropriate level" and gives the messages, and "These messages MUST also be consistent across languages". The service now logs these at
info, with the engine type being the class name of the data file's flow element.Updating on start-upCreating file system watcherChecking for updateChecking for update from '<url>' for Engine '<Engine type>'Downloaded new data from '<url>' for Engine '<Engine type>'Attempting to refresh Engine '<Engine type>' with new dataNo data newer than <datetime> found at '<url>' for Engine '<Engine type>'The 304 message is at
infoand not a warning.<datetime>is the HTTP date that was sent. The error table in the same section is followed at the levels it gives, with "Update will be attempted again later." added only when the data file hasauto_updateon. Connection failure, download failure (any status other than 200 or 304, with the status code as the detail) and a failed integrity check arewarning. A failed refresh, a failed write and a failed copy over the existing file areerror. The write and copy failures are now caught, reported toon_completeand followed by the next scheduled check, where before the exception ended the update thread.The earlier messages of the service (for example "Access denied from ...") are replaced by the specification's text.
Left alone
The MD5 comparison still reads the
content-md5header directly and raises if it is missing, as before. Items D3 and D8 are already met in Python, and D7 and D9 are not required by the specification, so this draft leaves them alone.Overlap with other drafts
No open draft touches
datafile_update_service.pyor the tests changed here (#53 changes usage sharing, #57 the performance profile). The release draft #67 was left alone.How it was verified
New tests are in
pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py. One existing test (testFileSystemWatcherKeepsWatchingAfterFailedRefresh) counted every log line and now counts only the error lines, as the watcher logs a new information line.rc: run 42651987401, 15 of the new engine tests fail (the header format, the wait,update_from_memorymissing, the log messages and levels, the connection failure raising).The last release into
mainmerged on 2026-11-04.Outstanding
Nothing in this change. The .NET message reads "Updating on startup", which differs by a hyphen from the specification table. This draft follows the specification table exactly.