Repository navigation
Move some lifecycle management from doTask -> shutdown for the mm-less task runner - #14895
Conversation
kfaraz
left a comment
There was a problem hiding this comment.
Looks good. Left a minor comment.
@georgew5656 , what would be the side effect of this if the TaskQueue is hypothetically slow in cleaning up finished tasks?
| protected void shutdown() | ||
| { | ||
| if (State.PENDING.equals(state.get()) || State.RUNNING.equals(state.get())) { | ||
| if (State.PENDING.equals(state.get()) || State.RUNNING.equals(state.get()) || State.STOPPED.equals(state.get())) { |
There was a problem hiding this comment.
Why do we need to handle STOPPED state here? Wouldn't the job have already finished?
There was a problem hiding this comment.
this is saying thats its okay to shutdown if its stopped
The two things that will hang around for a while |
YongGang
left a comment
There was a problem hiding this comment.
Nice cleanup, left one minor comment
| return; | ||
| } | ||
|
|
||
| synchronized (tasks) { |
There was a problem hiding this comment.
nit: the code can be simplified:
KubernetesWorkItem workItem;
synchronized (tasks) {
workItem = tasks.remove(taskid);
}
if (workItem == null) {
log.info("Ignoring request to cancel unknown task [%s]", taskid);
return;
}
…s task runner (#14895) * save work * Add syncronized * Don't shutdown in run * Adding unit tests * Cleanup lifecycle * Fix tests * remove newline
…s task runner (apache#14895) * save work * Add syncronized * Don't shutdown in run * Adding unit tests * Cleanup lifecycle * Fix tests * remove newline
…s task runner (apache#14895) * save work * Add syncronized * Don't shutdown in run * Adding unit tests * Cleanup lifecycle * Fix tests * remove newline
Description
The mm-less task runner differs in behavior from the other runners that run on the overlord because it tries to handle the cleanup lifecycle on its own by immediately deleting k8s jobs and clearing it's tasks map as soon as it has finished running a task.
The HttpRemoteTaskRunner and RemoteTaskRunner don't do this. Instead, they rely on the TaskQueue's handlers for the futures that all the task runners return to call shutdown on the task once it has completed.
Updating the mm-less task runner to use logic more similar to the other task runners has a couple benefits.
Changes
Release note
Update mm-less task runner lifecycle logic to better match the logic in the HTTP and Zookeeper worker task runners.
Key changed/added classes in this PR
KubernetesPeonLifecycleKubernetesTaskRunnerKubernetesWorkItemThis PR has: