-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Batch Job Garbage Collection #3982
Conversation
if remaining <= available { | ||
for _, job := range jobs[submittedJobs:] { | ||
jns := structs.NamespacedID{ID: job.ID, Namespace: job.Namespace} | ||
req.Jobs[jns] = option |
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.
Little nervous about sharing a pointer to the same struct here, but nothing mutates it and it seems unlikely anything would ever go back through and mutate it so I think it's safe to leave.
return err | ||
} | ||
|
||
// If the job is periodic or parameterized, we don't create an eval. |
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.
Why?
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.
The scheduler doesn't do anything for those job types. It does work for the derived batch jobs from them
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.
Ah sure, that makes sense. Maybe in future comments add a because ...
clause as what the code is doing is fairly obvious, but why it's doing it is not.
nomad/job_endpoint.go
Outdated
} | ||
|
||
// Lookup the job | ||
snap, err := j.srv.fsm.State().Snapshot() |
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.
Do this once outside the loop
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. |
This PR introduces a new endpoint to batch deregister jobs. This allows the
garbage collector to remove many jobs more efficiently.