Improve scheduler reliability: isolate step failures, catch Redis errors in export - #153
Open
t0kubetsu wants to merge 1 commit into
Open
Improve scheduler reliability: isolate step failures, catch Redis errors in export#153t0kubetsu wants to merge 1 commit into
t0kubetsu wants to merge 1 commit into
Conversation
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.
Summary
Fixes #142. Three related reliability gaps in
scheduler.py.Changes
1. Step isolation in
_run_scheduler_stepA bare
step_func()call with no error handling meant one failing step silently skipped all remaining steps for the tick (report generation, job cleanup, etc.). Wrapped intry/except Exceptionwithlogger.exception— each step now fails independently.2. Failure tracking in
task_master_of_puppetsAPScheduler silently swallows unhandled tick exceptions. Added an
except Exceptionclause that logs withlogger.exceptionand incrementsdb.app.config["scheduler_failures"], making scheduler health observable.3. Widen export exception handler
task_export_to_dbsonly caughtMeilisearchApiErrorandHTTPError. A Redis error duringflush_batch()would propagate uncaught, causing a partial Meilisearch write with no Kvrocks update (stores diverge silently). Addedredis.exceptions.RedisError,OSError, andjson.JSONDecodeErrorto the except clause. Changedlogger.errortologger.exceptionto preserve the traceback.Test plan
db.app.config["scheduler_failures"]increments on tick exception