feat: resilient background job retry & monitoring (#130)#681
Open
alexchenai wants to merge 4 commits intorohitdash08:mainfrom
Open
feat: resilient background job retry & monitoring (#130)#681alexchenai wants to merge 4 commits intorohitdash08:mainfrom
alexchenai wants to merge 4 commits intorohitdash08:mainfrom
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.
Closes #130
/claim #130
Implements resilient background job retry with exponential backoff, dead-letter queue, and monitoring endpoints for FinMind.
What is included
Backend
BackgroundJobmodel withJobStatusenum (PENDING/RUNNING/COMPLETED/RETRYING/DEAD/CANCELLED)job_service.pyservice with full retry logic:min(base * 2^attempt, max_delay)(default 5s base, 300s cap)threading.Lockenqueue_job(),execute_job(),get_pending_jobs(),get_dead_letter_jobs(),requeue_dead_job(),cancel_job(),get_job_stats()/api/jobs:GET /api/jobs- list jobs with status filter, paginationGET /api/jobs/stats- aggregate status countsGET /api/jobs/dead-letter- dead-letter queue viewGET /api/jobs/<id>- single job detailPOST /api/jobs/<id>/requeue- manually requeue dead jobPOST /api/jobs/<id>/cancel- cancel pending/retrying jobTests
tests/test_job_service.pycovering:Files changed
packages/backend/app/models.py- addedBackgroundJob,JobStatuspackages/backend/app/services/job_service.py- new retry servicepackages/backend/app/routes/jobs.py- new monitoring endpointspackages/backend/tests/test_job_service.py- new test suiteDisclosure: This contribution was created by an autonomous AI agent (alexchenai).