Conversation
wlggraham
commented
Feb 19, 2026
| } | ||
|
|
||
| // Stop all tasks where LastStatus != STOPPED or SUCCEEDED | ||
| for _, task := range describeOutput.Tasks { |
Contributor
Author
There was a problem hiding this comment.
This is not necessary. The API will not fail if you try to stop an already-stopped task.
hladush
reviewed
Feb 19, 2026
| // Log error but continue stopping other tasks | ||
| cleanupMethod.LogAndCountError(err, fmt.Sprintf("failed to stop task %s", aws.ToString(task.TaskArn))) | ||
| continue | ||
| cleanupMethod.LogAndCountError(err, fmt.Sprintf("failed to stop task %s", taskARN)) |
hladush
reviewed
Feb 19, 2026
| for taskNum := 0; taskNum < e.TaskCount; taskNum++ { | ||
| maxTaskCount := clusterContext.MaxTaskCount | ||
|
|
||
| taskARNs := make(map[string]struct{}) |
hladush
previously approved these changes
Feb 19, 2026
hladush
approved these changes
Feb 20, 2026
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.
The Cleanup() function would use the
task_countfrom the command context, which can be overridden by the job context. This means that any jobs excess of the command context were not being canceled properly.The new solution takes the max_tasks from the cluster context and tries to cancel any potential job in that range. For example, if the max_tasks is 3, but the job context only specified 1, then it would try stopping all of the following tasks (searched for by the
startedByfield):heimdall-job-68e65fff-d53f-408d-a8b4-5a429b3c5e14-0heimdall-job-68e65fff-d53f-408d-a8b4-5a429b3c5e14-1heimdall-job-68e65fff-d53f-408d-a8b4-5a429b3c5e14-2This makes it so we don't need to find the old jobContext anywhere using the jobID.
I tested this locally and ensured both cancelation and stale job cleanup worked. In both cases, all jobs were canceled.