Skip to content

Kill all running tasks when the supervisor task is killed#7041

Merged
jihoonson merged 3 commits intoapache:masterfrom
jihoonson:kill-subtasks
Mar 1, 2019
Merged

Kill all running tasks when the supervisor task is killed#7041
jihoonson merged 3 commits intoapache:masterfrom
jihoonson:kill-subtasks

Conversation

@jihoonson
Copy link
Copy Markdown
Contributor

Currently, the index_parallel supervisor task kills sub tasks when one of them fails, but it doesn't if someone kills itself. This PR is to kill sub tasks in stopGracefully() of the supervisor task.

@Override
public TaskState run() throws Exception
{
if (baseFirehoseFactory.getNumSplits() == 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

wondering what if getNumSplits() returns 1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If it's 1, the native parallel task currently does the same thing: the supervisor task will run a sub task for the single split. Do you think it's better to process in the supervisor task rather than processing in the sub task?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

may be i was thinking in that direction, but I guess it's okay to run a sub task for single split.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I think it makes sense, but probably better to fix in a separate PR.

// Currently, this metric only represents # of killed tasks by ParallelIndexTaskRunner.
// See killAllRunningTasks(), SinglePhaseParallelIndexTaskRunner.run(), and
// SinglePhaseParallelIndexTaskRunner.stopGracefully()
@VisibleForTesting
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I did not understand this annotation here, since numKilledTasks is private.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm.. I don't remember what I was thinking. Moved @ VisibleForTesting to getNumKilledTasks(). Thanks!

}
}

int getNumKilledTasks()
Copy link
Copy Markdown

@surekhasaharan surekhasaharan Feb 21, 2019

Choose a reason for hiding this comment

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

May make sense to add the annotation @VisibleForTesting here instead

Copy link
Copy Markdown

@surekhasaharan surekhasaharan left a comment

Choose a reason for hiding this comment

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

sorry for delay, LGTM.

@Override
public TaskState run() throws Exception
{
if (baseFirehoseFactory.getNumSplits() == 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

may be i was thinking in that direction, but I guess it's okay to run a sub task for single split.

@jihoonson jihoonson merged commit 06c8229 into apache:master Mar 1, 2019
@jihoonson jihoonson added this to the 0.15.0 milestone May 16, 2019
private int numFailedTasks;
// This metric is used only for unit tests because the current taskStatus system doesn't track the killed task status.
// Currently, this metric only represents # of killed tasks by ParallelIndexTaskRunner.
// See killAllRunningTasks(), SinglePhaseParallelIndexTaskRunner.run(), and
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There was no method killAllRunningTasks() anywhere in the repo when this PR was checked in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, thanks. Will fix it soon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@leventov fixed in #8924.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants