Interruptible inference-model-updater loop #427
Merged
Merged
Conversation
Three related changes to make the inference-model-updater more responsive to set_config calls and robust against misconfigured refresh_rate values. 1. Move get_active_detector_ids() onto DatabaseManager as a class method. The module-level function in edge_config_manager.py now delegates to it, keeping all existing callers working unchanged. 2. Add _wait_for_next_cycle(db_manager, wait) to replace the bare time.sleep(sleep_duration) in the model-update loop. The function polls every 2s and returns early if set_config added or removed a detector (detected via get_active_detector_ids / get_pending_deletions). The baseline is captured once at entry (edge-triggered) so a permanently- failing deployment never causes a busy loop. wait=None means sleep indefinitely until a detector change appears, enabling refresh_rate=None. 3. Update the call site to pass wait=None when refresh_rate is None, and update configs/edge-config.yaml and CONFIGURING-DETECTORS.md to document the new null-to-disable behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
…-endpoint into refresh-rate-resilience
…-endpoint into refresh-rate-resilience
inference-model-updater loop
timmarkhuff
commented
Jun 15, 2026
| # For configuring detectors on the edge endpoint. See CONFIGURING-DETECTORS.md for more information. | ||
|
|
||
| global_config: # These settings affect the overall behavior of the edge endpoint. | ||
| refresh_rate: 60 # How often to attempt to fetch updated ML models (in seconds). Defaults to 60. |
Contributor
Author
There was a problem hiding this comment.
The default is defined by the python-sdk. Better not to include it in a comment here. The comment could become stale.
added 4 commits
June 15, 2026 10:41
timmarkhuff
commented
Jun 16, 2026
| "cachetools>=5.3.1,<6.0.0", | ||
| "fastapi>=0.115.0,<0.116.0", | ||
| "groundlight>=0.25.0,<0.26.0", | ||
| "groundlight>=0.29.0,<0.30.0", |
Contributor
Author
There was a problem hiding this comment.
We were a bit behind on our python-sdk version
timmarkhuff
added a commit
to groundlight/python-sdk
that referenced
this pull request
Jun 17, 2026
## Changes - Add `le=86400` to `GlobalConfig.refresh_rate`, capping the maximum value at 1 day. Values above this are now rejected at construction time with a clear `ValidationError`. ## Notes This PR is paired with groundlight/edge-endpoint#427, which makes the model-updater loop more responsive to `set_config` calls. Neither PR depends on the other for correctness. --------- Co-authored-by: Tim Huff <thuff@axon.com> Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Background
When the
inference-model-updatersleeps between update cycles, it does not respond toExperimentalApi.edge.set_configcalls. Ifrefresh_rateis high, this means adding orremoving detectors can be delayed by the full sleep duration.
Changes
Move
get_active_detector_ids()ontoDatabaseManageras a class method. Themodule-level function in
edge_config_manager.pydelegates to it; no callers break.Replace
time.sleepwith_wait_for_next_cyclein the model-update loop. Pollsevery 2s and wakes early if
set_configadded/removed a detector orrefresh_ratechanged. The detector baseline is captured once per cycle (before the per-detector loop)
and shared with both the mid-cycle check and the wait, so a config change detected
mid-cycle also causes
_wait_for_next_cycleto return immediately rather than sleeping.Early-exit mid-cycle — the per-detector for-loop checks after each detector and
breaks early if the config changed, restarting the outer loop immediately.
Notes
Paired with groundlight/python-sdk#439, which enforces a 1-day cap on
refresh_rate.