Skip to content
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

Move child task cancellation to TaskManager #44573

Conversation

javanna
Copy link
Member

@javanna javanna commented Jul 18, 2019

Today TransportCancelTasksAction takes care of eventually cancelling
children tasks when needed, by banning any new task from being started
using the id of the cancelled task as parent task id. Also, any ongoing
task with the parent task id set to the id of the cancelled task is
cancelled.

This change moves this logic, without modifying any behaviour, to from
TransportCancelTasksAction to TaskManager. This will allow to support
recursive cancellation of tasks as a folow-up, as currently only
children tasks are cancelled but for instance grand-children don't. Once
TaskManager is able to send ban request autonomously, it can support
cancelling grand-children tasks too.

Relates to #44494, as adding an integration tests showed that cancelling
msearch will only cancel its corresponding sub-searches, but not the
shard level requests that have the sub-search tasks as parent tasks.

Today TransportCancelTasksAction takes care of eventually cancelling
children tasks when needed, by banning any new task from being started
using the id of the cancelled task as parent task id. Also, any ongoing
task with the parent task id set to the id of the cancelled task is
cancelled.

This change moves this logic, without modifying any behaviour, to from
TransportCancelTasksAction to TaskManager. This will allow to support
recursive cancellation of tasks as a folow-up, as currently only
children tasks are cancelled but for instance grand-children don't. Once
TaskManager is able to send ban request autonomously, it can support
cancelling grand-children tasks too.
@javanna javanna added >enhancement :Distributed/Task Management Issues for anything around the Tasks API - both persistent and node level. v8.0.0 v7.4.0 labels Jul 18, 2019
@javanna javanna requested a review from imotov July 18, 2019 14:56
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@javanna
Copy link
Member Author

javanna commented Jul 22, 2019

This change introduces a cyclic dependency between TransportService and TaskManager. We are going to make msearch tasks cancellable in a different way. @imotov suggested that TaskManager#setBan can return a list of cancelled task ids, and TransportCancelTasksAction can be updated to go and set a ban for those cancelled tasks too, and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Task Management Issues for anything around the Tasks API - both persistent and node level. >enhancement v7.4.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants