Support retrying interrupted FARGATE task#53
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for automatically retrying FARGATE_SPOT tasks that are interrupted by AWS. The implementation detects when a task is interrupted by matching the "Your Spot Task was interrupted" message in the task's stopped reason and triggers a retry mechanism.
- Adds detection for FARGATE_SPOT task interruptions using regex pattern matching
- Implements retry logic for interrupted spot tasks similar to existing host termination handling
- Updates CI configuration to test against newer Ruby versions (3.3, 3.4) while removing older versions (2.7, 3.0, 3.1)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/wrapbox/runner/ecs.rb | Adds regex constant and retry logic for detecting and handling interrupted FARGATE_SPOT tasks |
| .github/workflows/main.yml | Updates Ruby version matrix for CI testing to include newer versions |
Comments suppressed due to low confidence (1)
lib/wrapbox/runner/ecs.rb:31
- [nitpick] The constant name SPOT_TASK_INTERRUPTED should include 'REGEXP' suffix to match the naming pattern of HOST_TERMINATED_REASON_REGEXP for consistency.
SPOT_TASK_INTERRUPTED = /Your Spot Task was interrupted/
| WAIT_DELAY = 5 | ||
| TERM_TIMEOUT = 120 | ||
| HOST_TERMINATED_REASON_REGEXP = /Host EC2.*terminated/ | ||
| SPOT_TASK_INTERRUPTED = /Your Spot Task was interrupted/ |
There was a problem hiding this comment.
The regex pattern should end with a word boundary or be more specific to avoid potential false matches if AWS changes the message format slightly. Consider using /Your Spot Task was interrupted\b/ or anchoring the pattern.
Suggested change
| SPOT_TASK_INTERRUPTED = /Your Spot Task was interrupted/ | |
| SPOT_TASK_INTERRUPTED = /Your Spot Task was interrupted\b/ |
Contributor
Author
|
@joker1007 @akihiro17 Can you take a look? |
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.
Tasks executed with FARGATE_SPOT may be interrupted. When interrupted, the following log is output.
Handling this log, the Spot Task is retried in the wrapbox. This