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

Include the calling transport task in the method for individual node task operations #88081

Merged

Conversation

benwtrent
Copy link
Member

Currently, if the parent transport task is cancelled, there is no way to propagate the cancellation to any NEW transport action inacted by TransportTasksAction#taskOperation.

This commit passes the originating transport task into TransportTasksAction#taskOperation so that any additional transport actions can be cancelled if the originating transport task is cancelled.

Note: it is up to the implementer to enable this cancellation logic. This commit simply updates the framework to make it possible.

@benwtrent benwtrent added :Distributed Coordination/Task Management Issues for anything around the Tasks API - both persistent and node level. >refactoring v8.4.0 labels Jun 27, 2022
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Jun 27, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM although I have minor (non-blocking) concerns about naming.

@@ -113,6 +113,7 @@ protected void processTasks(final FollowStatsAction.StatsRequest request, final

@Override
protected void taskOperation(
Task transportTask,
Copy link
Contributor

Choose a reason for hiding this comment

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

Harmonisation nit:

Suggested change
Task transportTask,
final Task transportTask,

*/
protected abstract void taskOperation(TasksRequest request, OperationTask task, ActionListener<TaskResponse> listener);
protected abstract void taskOperation(
Task transportTask,
Copy link
Contributor

Choose a reason for hiding this comment

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

I worry a bit about the name transportTask, given that many of these tasks actions will be iterating over transport tasks too. What about requestTask or actionTask perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

actionTask is nice. I will rename to that

@benwtrent
Copy link
Member Author

@elasticmachine update branch

@benwtrent benwtrent merged commit 3538e9c into elastic:master Jun 28, 2022
@benwtrent benwtrent deleted the feature/make-task-operations-cancellable branch June 28, 2022 15:55
benwtrent added a commit that referenced this pull request Jul 20, 2022
We pass the actionTask to the subsequent task action so that the task action can be cancelled if the upstream tasks are cancelled.

But, the actionTask passed is created by the `NodeTaskRequest`, which isn't cancellable. 

This commit addresses this discrepancy and allows for down stream task actions to be cancelled if the upstream http connections are closed.

Related to: #88081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Task Management Issues for anything around the Tasks API - both persistent and node level. >refactoring Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants