Repository navigation
Move some lifecycle management from doTask -> shutdown for the mm-less task runner #14895
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a8e921f
save work
633f391
Merge branch 'master' of github.com:georgew5656/druid into saveTaskLo…
ba4d1e2
Add syncronized
137f740
Don't shutdown in run
3cb910b
Adding unit tests
7f5caef
Cleanup lifecycle
7d0a3ea
Fix tests
dccca17
Fix merge conflicts
f72a3ca
remove newline
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,10 +182,6 @@ protected TaskStatus doTask(Task task, boolean run) | |
| KubernetesWorkItem workItem = tasks.get(task.getId()); | ||
|
|
||
| if (workItem == null) { | ||
| throw new ISE("Task [%s] disappeared", task.getId()); | ||
| } | ||
|
|
||
| if (workItem.isShutdownRequested()) { | ||
| throw new ISE("Task [%s] has been shut down", task.getId()); | ||
| } | ||
|
|
||
|
|
@@ -213,11 +209,6 @@ protected TaskStatus doTask(Task task, boolean run) | |
| log.error(e, "Task [%s] execution caught an exception", task.getId()); | ||
| throw new RuntimeException(e); | ||
| } | ||
| finally { | ||
| synchronized (tasks) { | ||
| tasks.remove(task.getId()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
|
|
@@ -271,6 +262,10 @@ public void shutdown(String taskid, String reason) | |
| return; | ||
| } | ||
|
|
||
| synchronized (tasks) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the code can be simplified: |
||
| tasks.remove(taskid); | ||
| } | ||
|
|
||
| workItem.shutdown(); | ||
| } | ||
|
|
||
|
|
@@ -440,6 +435,17 @@ public Collection<TaskRunnerWorkItem> getPendingTasks() | |
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @Override | ||
| public TaskLocation getTaskLocation(String taskId) | ||
| { | ||
| final KubernetesWorkItem workItem = tasks.get(taskId); | ||
| if (workItem == null) { | ||
| return TaskLocation.unknown(); | ||
| } else { | ||
| return workItem.getLocation(); | ||
| } | ||
| } | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public RunnerTaskState getRunnerTaskState(String taskId) | ||
|
|
||
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
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
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
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
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.
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 do we need to handle STOPPED state here? Wouldn't the job have already finished?
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.
this is saying thats its okay to shutdown if its stopped