-
Notifications
You must be signed in to change notification settings - Fork 66
Add build timeout handling and TIMED_OUT state #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add build timeout handling and TIMED_OUT state #204
Conversation
|
Hello @shiv-tyagi, |
9c6c662 to
02ee09e
Compare
|
Hello @shiv-tyagi, I’ve updated the PR as per your review:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is taking a good shape now. Please address the comments I have posted. One more thing, in the web/static/js/index.js file, there is a piece of code which decides the colour of labels for the build states. Put the timed out state in red along with FAILURE and ERROR states.
shiv-tyagi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @lakhmanisahil! Can you confirm if you have tested this?
|
One more thing, your commits need to be organised. You should have just four commits,
Where xxx, yyy, zzz and abc are descriptions about what your commit does to those modules. https://ardupilot.org/dev/docs/git-interactive-rebase.html |
Yes, i have tested it with different builds and timeout value. |
Thank You @shiv-tyagi , i will look into and update it soon. |
7a2e64b to
d10ba58
Compare
2cbae25 to
02b8f7b
Compare
|
Hi @shiv-tyagi, I've cleaned up the PR history. It now contains exactly 4 commits:
Changes summary:
|
Fixes #201
Summary
This PR implements a 15-minute timeout for builds to prevent them from remaining indefinitely in the
RUNNINGstate. It introduces a newTIMED_OUTbuild state and enforces timeout handling independently in the builder and progress updater, following maintainer guidance.Changes Made
1. Core Timeout Infrastructure
BuildState.TIMED_OUTto represent builds terminated due to timeoutBUILD_TIMEOUT_SECONDS = 900) incommon/config.pytime_started_runningtoBuildInfoto track when a build actually begins executionerror_messagetoBuildInfoto store timeout and failure details2. Builder (
builder/builder.py)configure,clean,build) usingtimeout=BUILD_TIMEOUT_SECONDSsubprocess.TimeoutExpired:__check_if_timed_out()to detect if the progress updater has already marked a build asTIMED_OUT3. Build Manager (
build_manager/manager.py)mark_build_timed_out()to safely transition builds toTIMED_OUTSUCCESS,FAILURE)time_started_runningwhen a build enters theRUNNINGstateBuildInfo.to_dict()usinggetattr()to maintain backward compatibility with existing Redis entries4. Progress Updater (
build_manager/progress_updater.py)__check_build_timeout()invoked from the existing periodic update looptime_started_running(nottime_created) for accuracytime_started_runningis not yet availableTIMED_OUTonce the timeout threshold is exceededTIMED_OUTin state and progress update paths5. Web API (
web/app.py)/api/builds/<build_id>/statusendpoint for lightweight pollingget_all_builds()by skipping and logging individual build errors instead of failing the entire requestremote_name/commit_ref)Implementation Details
As suggested by the maintainer, timeout handling is implemented independently in two places:
Builder subprocess timeout
Each subprocess call is bounded by
BUILD_TIMEOUT_SECONDS. If exceeded, the process is terminated and the build is aborted.Progress updater timeout detection
The existing periodic task checks whether any
RUNNINGbuild has exceeded the timeout since entering the running state and marks it asTIMED_OUT.Both mechanisms coordinate via
BuildState.TIMED_OUT:This preserves separation of responsibilities while keeping behavior consistent.
Testing
Backward Compatibility
time_started_running,error_message) are accessed viagetattr()Future Work (not included)
Supporting Images (checked for 2 minutes)