-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure task in error or retry children are properly cancelled (#790
) # Motivation When tasks postprocessing is not executed, children tasks and results are not aborted. It lets a lot of tasks and results in Creating, adding lot of noise when debugging and misleading remnants of failed tasks as tasks that could potentially complete. # Description Move children (tasks and results) cancellation from Agent.CancelChild to Submitter.CompleteAsync ensuring that children cancellation is called everytime a task is set to Error or Retry. It uses the new CreatedBy field to find all related tasks and results. # Testing - Unit test were added to make sure children were properly cancelled when tasks return an Error. - Validated using integration tests: HtcMock is able to produce exception during task execution, generating retries. All children tasks were cancelled. # Impact - Improved debugging - Clearer end of session # Checklist - [x] My code adheres to the coding and style guidelines of the project. - [x] I have performed a self-review of my code. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have made corresponding changes to the documentation. - [x] I have thoroughly tested my modifications and added tests when necessary. - [x] Tests pass locally and in the CI. - [x] I have assessed the performance impact of my modifications.
- Loading branch information
Showing
9 changed files
with
231 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file is part of the ArmoniK project | ||
// | ||
// Copyright (C) ANEO, 2021-2024. All rights reserved. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published | ||
// by the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY, without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using ArmoniK.Core.Common.Pollster; | ||
using ArmoniK.Core.Common.Storage; | ||
|
||
using Microsoft.Extensions.Logging; | ||
|
||
namespace ArmoniK.Core.Common.Tests.Helpers; | ||
|
||
public class WrapperAgentHandler : IAgentHandler | ||
{ | ||
private readonly IAgent agent_; | ||
|
||
public WrapperAgentHandler(IAgent agent) | ||
=> agent_ = agent; | ||
|
||
public Task Stop(CancellationToken cancellationToken) | ||
=> Task.CompletedTask; | ||
|
||
public Task<IAgent> Start(string token, | ||
ILogger logger, | ||
SessionData sessionData, | ||
TaskData taskData, | ||
string folder, | ||
CancellationToken cancellationToken) | ||
=> Task.FromResult(agent_); | ||
} |
This file contains 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