Repository navigation
Fix shutdown in httpRemote task runner - #13558
AmatyaAvadhanula merged 5 commits into
Conversation
kfaraz
left a comment
There was a problem hiding this comment.
Thanks for the fix, @AmatyaAvadhanula . Could you also add a test that verifies the emission of the task/run/time metric in case of a forced shutdown?
| } | ||
|
|
||
| @Test | ||
| public void testShutdown() |
There was a problem hiding this comment.
Could you add some more info, either as a comment or in the method name itself to clarify what this method validates?
|
@kfaraz thank you for the review! The test has been added as well |
| } | ||
|
|
||
| @Test | ||
| public void testHttpRemoteTaskRunnerTaskShutdownMetricsEmission() throws EntryExistsException, InterruptedException |
There was a problem hiding this comment.
Shouldn't this test be a part of HttpRemoteTaskRunnerTest?
There was a problem hiding this comment.
TaskQueue emits task/run/time
| } | ||
|
|
||
| @Test | ||
| public void testHttpRemoteTaskRunnerTaskShutdownMetricsEmission() throws EntryExistsException, InterruptedException |
There was a problem hiding this comment.
| public void testHttpRemoteTaskRunnerTaskShutdownMetricsEmission() throws EntryExistsException, InterruptedException | |
| public void testKilledTasksEmitRuntimeMetric() throws EntryExistsException, InterruptedException |
| ); | ||
| taskQueue.add(task); | ||
| taskQueue.manageInternal(); | ||
| taskRunner.taskAddedOrUpdated(TaskAnnouncement.create( |
There was a problem hiding this comment.
This is an internal method. We should avoid calling this in the test. Is it not possible to verify the behaviour just by invoking shutdown and verifying the emitted metric?
There was a problem hiding this comment.
The test is a bit verbose because it requires the verification of metrics in the TaskQueue when HttpRemoteTaskRunner is used in particular
There was a problem hiding this comment.
I meant if it is possible to verify the behaviour without calling this method taskAddedOrupdated().
|
|
||
| private HttpRemoteTaskRunner createTaskRunnerForTestTaskAddedOrUpdated( | ||
| /** | ||
| * Validate the internal state of tasks withing the task runner |
There was a problem hiding this comment.
Thanks for adding the comments! But this seems a little broad for a test. If you are validating multiple things, consider breaking up the test.
kfaraz
left a comment
There was a problem hiding this comment.
Left some suggestions for the tests. The code change looks good.
|
Merging since the failed ITs are unrelated |
* Fix shutdown in httpRemote task runner * Add UT
Description
HttpRemoteTaskRunner#shutdown doesn't execute the shutdown hooks and this led to discrepancies such as
task/run/timenot being emitted by cancelled tasks or those shutdown by the supervisor.This patch retains the task in the set of tasks within HttpRemoteTaskRunner and clears them only when the state is already completed.
Key changed/added classes in this PR
HttpRemoteTaskRunnerThis PR has: