You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: [RunInference] WatchFilePattern may fail to correctly identify the most recent model #40638
WatchFilePattern helps update a model in a RunInference pipeline on the fly. It monitors a location to find recently uploaded models and then has some logic to decide which model is the most recent one.
The logic is flawed for several reasons:
_GetLatestFileByTimeStamp is a stateful DoFn. In Beam, state is partitioned per key, and right before calling _GetLatestFileByTimeStamp, we key each file name with its path:
. Because keys are different and state is partitioned per key, we don't have an overview of the entirety of available models. Each new file path gets a fresh TIME_STATE initialized to _START_TIME_STAMP, files are never compared against the latest timestamp of previously seen files, so an older file uploaded after _START_TIME_STAMP may still be emitted as the "latest" model.
if more than one model is detected in the window during the poll, each with it own name, _ConvertIterToSingleton will emit a list of elements, this is well-illustrated by the existing test
. When RunInference consumes this via beam.pvalue.AsSingleton(...), it will crash since the value is not a singleton.
Checking for timestamps might not be reliable for file systems that preserve the creation time when copying a file into a location. This is not a concern on GCS, since the timestamp is defined by object upload time, but if model is read from a local folder, reverting to an older model might not create desired results if some other model has a newer timestamp than the desired model to which we want to revert the processing. Though maybe a user would need to go out of their way to mess up the metadata, likely this is minor.
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Activity
tvalentyn commentedon Oct 16, 2026
Worth noting that side inputs updates can take a while, but there is a workaround: #28776 (comment)