Skip to content
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

Remove terminal allocations associated with older job modify index #4839

Merged
merged 2 commits into from
Nov 9, 2018

Conversation

preetapan
Copy link
Member

This PR changes batch job GC behavior such that terminal allocations that have the same job id, but associated with an older job modify index get garbage collected.

This handles the case where a batch job is stopped and purged, and then resubmitted with the same id. In Nomad 0.8.6, any terminal allocations of the job at the older job modify index dont' get garbage collected until the resubmitted job is also eligible for gc.

@preetapan preetapan requested a review from dadgar November 4, 2018 21:51
func olderVersionTerminalAllocs(allocs []*structs.Allocation, job *structs.Job) []string {
var ret []string
for _, alloc := range allocs {
if alloc.Job != nil && alloc.Job.JobModifyIndex < job.JobModifyIndex && alloc.TerminalStatus() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you really want to test is the JobCreateIndex. I could change the priority of a job and that would change the job modify index. That doesn't mean we should GC its allocations. They are still potentially useful for scheduling decisions.

@preetapan preetapan merged commit 92c1ed8 into master Nov 9, 2018
@preetapan preetapan deleted the b-gc-alloc-jobversion branch November 9, 2018 18:21
@tantra35
Copy link
Contributor

tantra35 commented Nov 10, 2018

@preetapan we just test this patch by backport it to 0.8.6 on test stand and found that if situations described here #4532, it doesn't works, due JobCreateIndex doesn't changed in case described in #4532

@preetapan preetapan restored the b-gc-alloc-jobversion branch November 13, 2018 20:21
@preetapan preetapan deleted the b-gc-alloc-jobversion branch December 11, 2018 23:05
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants