Skip to content

Commit 5a14064

Browse files
authored
Merge pull request #744 from Project-MONAI/release/0.1.18
Release/0.1.18
2 parents 209cb3b + ab910eb commit 5a14064

File tree

96 files changed

+3729
-411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3729
-411
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ jobs:
251251
env:
252252
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253253
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
254-
run: dotnet sonarscanner begin /k:"Project-MONAI_monai-deploy-workflow-manager" /o:"project-monai" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="../**/coverage.opencover.xml" /d:sonar.coverage.exclusions="src/WorkflowManager/Database/Repositories/**/*,src/TaskManager/Database/TaskDispatchEventRepository.cs"
254+
run: dotnet sonarscanner begin /k:"Project-MONAI_monai-deploy-workflow-manager" /o:"project-monai" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="../**/coverage.opencover.xml" /d:sonar.coverage.exclusions="src/WorkflowManager/Database/Repositories/**/*,src/TaskManager/Database/TaskDispatchEventRepository.cs,**/Migrations/M0*.cs"
255255
working-directory: ./src
256256

257257
- name: Restore Solution

doc/dependency_decisions.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,3 +2506,33 @@
25062506
:versions:
25072507
- 4.3.0
25082508
:when: 2023-02-02 15:35:00.000000000 Z
2509+
2510+
- - :approve
2511+
- System.IO.Pipelines
2512+
- :who: neildsouth
2513+
:why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT)
2514+
:versions:
2515+
- 6.0.3
2516+
:when: 2023-04-11 13:37:00.000000000 Z
2517+
- - :approve
2518+
- Microsoft.Extensions.DependencyModel
2519+
- :who: neildsouth
2520+
:why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT)
2521+
:versions:
2522+
- 6.0.0
2523+
:when: 2023-04-11 13:37:00.000000000 Z
2524+
- - :approve
2525+
- Microsoft.AspNetCore.TestHost
2526+
- :who: neildsouth
2527+
:why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT)
2528+
:versions:
2529+
- 6.0.15
2530+
:when: 2023-04-11 13:37:00.000000000 Z
2531+
- - :approve
2532+
- Microsoft.AspNetCore.Mvc.Testing
2533+
- :who: neildsouth
2534+
:why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT)
2535+
:versions:
2536+
- 6.0.15
2537+
:when: 2023-04-11 13:37:00.000000000 Z
2538+

src/.sonarlint/sonar.settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"sonar.exclusions":[],"sonar.global.exclusions":["**/build-wrapper-dump.json"],"sonar.inclusions":[]}
1+
{"sonar.exclusions":[],"sonar.global.exclusions":["**/build-wrapper-dump.json","**/Migrations/*.cs"],"sonar.inclusions":[]}

src/Shared/Configuration/MessageBrokerConfigurationKeys.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,23 @@ public class MessageBrokerConfigurationKeys
6464

6565
/// <summary>
6666
/// Gets or sets the topic for publishing task update events.
67-
/// Defaults to `md.tasks.update`.
67+
/// Defaults to `md.tasks.cancellation`.
6868
/// </summary>
6969
[ConfigurationKeyName("taskCancellation")]
7070
public string TaskCancellationRequest { get; set; } = "md.tasks.cancellation";
7171

7272
/// <summary>
7373
/// Gets or sets the topic for publishing clinical review request events.
74-
/// Defaults to `md.tasks.update`.
74+
/// Defaults to `aide.clinical_review.request`.
7575
/// </summary>
7676
[ConfigurationKeyName("aideClinicalReviewRequest")]
7777
public string AideClinicalReviewRequest { get; set; } = "aide.clinical_review.request";
78+
79+
/// <summary>
80+
/// Gets or sets the topic for publishing clinical review cancelation events.
81+
/// Defaults to `aide.clinical_review.cancellation`.
82+
/// </summary>
83+
[ConfigurationKeyName("aideClinicalReviewCancelation")]
84+
public string AideClinicalReviewCancelation { get; set; } = "aide.clinical_review.cancellation";
7885
}
7986
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2023 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
using Microsoft.Extensions.Configuration;
17+
18+
namespace Monai.Deploy.WorkflowManager.Configuration
19+
{
20+
public class PagedOptions
21+
{
22+
/// <summary>
23+
/// Represents the <c>endpointSettings</c> section of the configuration file.
24+
/// </summary>
25+
[ConfigurationKeyName("endpointSettings")]
26+
public EndpointSettings EndpointSettings { get; set; }
27+
}
28+
}

src/Shared/Configuration/WorkflowManagerOptions.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
*/
1616

1717
using System;
18+
using System.Collections.Generic;
1819
using Microsoft.Extensions.Configuration;
1920

2021
namespace Monai.Deploy.WorkflowManager.Configuration
2122
{
22-
public class WorkflowManagerOptions
23+
public class WorkflowManagerOptions : PagedOptions
2324
{
2425
/// <summary>
2526
/// Name of the key for retrieve database connection string.
@@ -44,15 +45,13 @@ public class WorkflowManagerOptions
4445
[ConfigurationKeyName("taskManager")]
4546
public TaskManagerConfiguration TaskManager { get; set; }
4647

47-
/// <summary>
48-
/// Represents the <c>endpointSettings</c> section of the configuration file.
49-
/// </summary>
50-
[ConfigurationKeyName("endpointSettings")]
51-
public EndpointSettings EndpointSettings { get; set; }
52-
5348
[ConfigurationKeyName("taskTimeoutMinutes")]
5449
public double TaskTimeoutMinutes { get; set; } = 60;
5550

51+
[ConfigurationKeyName("perTaskTypeTimeoutMinutes")]
52+
public Dictionary<string, double> PerTaskTypeTimeoutMinutes { get; set; }
53+
54+
5655
public TimeSpan TaskTimeout { get => TimeSpan.FromMinutes(TaskTimeoutMinutes); }
5756

5857
/// <summary>
Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,33 @@
1414
* limitations under the License.
1515
*/
1616

17-
using System;
18-
using System.Collections.Generic;
1917
using System.Net;
2018
using Ardalis.GuardClauses;
2119
using Microsoft.AspNetCore.Mvc;
2220
using Microsoft.Extensions.Options;
2321
using Monai.Deploy.WorkflowManager.Configuration;
24-
using Monai.Deploy.WorkflowManager.Filter;
25-
using Monai.Deploy.WorkflowManager.Services;
26-
using Monai.Deploy.WorkflowManager.Wrappers;
22+
using Monai.Deploy.WorkflowManager.Shared.Filter;
23+
using Monai.Deploy.WorkflowManager.Shared.Wrappers;
24+
using Monai.Deploy.WorkflowManager.Shared.Services;
25+
using Microsoft.AspNetCore.Routing;
2726

28-
namespace Monai.Deploy.WorkflowManager.Controllers
27+
namespace Monai.Deploy.WorkflowManager.ControllersShared
2928
{
3029
/// <summary>
3130
/// Base Api Controller.
3231
/// </summary>
3332
[ApiController]
3433
public class ApiControllerBase : ControllerBase
3534
{
36-
private readonly IOptions<WorkflowManagerOptions> _options;
35+
public IOptions<WorkflowManagerOptions> Options { get; set; }
3736

3837
/// <summary>
3938
/// Initializes a new instance of the <see cref="ApiControllerBase"/> class.
4039
/// </summary>
4140
/// <param name="options">Workflow manager options.</param>
42-
public ApiControllerBase(IOptions<WorkflowManagerOptions> options)
41+
public ApiControllerBase(IOptions<WorkflowManagerOptions> Options)
4342
{
44-
_options = options ?? throw new ArgumentNullException(nameof(options));
43+
this.Options = Options ?? throw new ArgumentNullException(nameof(Options));
4544
}
4645

4746
/// <summary>
@@ -69,34 +68,26 @@ public ApiControllerBase(IOptions<WorkflowManagerOptions> options)
6968
/// <param name="uriService">Uri service.</param>
7069
/// <param name="route">Route.</param>
7170
/// <returns>Returns <see cref="PagedResponse{T}"/>.</returns>
72-
public PagedResponse<List<T>> CreatePagedReponse<T>(List<T> pagedData, PaginationFilter validFilter, long totalRecords, IUriService uriService, string route)
71+
public PagedResponse<IEnumerable<T>> CreatePagedReponse<T>(IEnumerable<T> pagedData, PaginationFilter validFilter, long totalRecords, IUriService uriService, string route)
7372
{
7473
Guard.Against.Null(pagedData);
7574
Guard.Against.Null(validFilter);
7675
Guard.Against.Null(route);
7776
Guard.Against.Null(uriService);
7877

79-
var pageSize = validFilter.PageSize ?? _options.Value.EndpointSettings.DefaultPageSize;
80-
var respose = new PagedResponse<List<T>>(pagedData, validFilter.PageNumber, pageSize);
81-
var totalPages = (double)totalRecords / pageSize;
82-
var roundedTotalPages = Convert.ToInt32(Math.Ceiling(totalPages));
78+
var pageSize = validFilter.PageSize ?? Options.Value.EndpointSettings.DefaultPageSize;
79+
var respose = new PagedResponse<IEnumerable<T>>(pagedData, validFilter.PageNumber, pageSize);
8380

84-
respose.NextPage =
85-
validFilter.PageNumber >= 1 && validFilter.PageNumber < roundedTotalPages
86-
? uriService.GetPageUriString(new PaginationFilter(validFilter.PageNumber + 1, pageSize), route)
87-
: null;
88-
89-
respose.PreviousPage =
90-
validFilter.PageNumber - 1 >= 1 && validFilter.PageNumber <= roundedTotalPages
91-
? uriService.GetPageUriString(new PaginationFilter(validFilter.PageNumber - 1, pageSize), route)
92-
: null;
81+
respose.SetUp(validFilter, totalRecords, uriService, route);
82+
return respose;
83+
}
9384

94-
respose.FirstPage = uriService.GetPageUriString(new PaginationFilter(1, pageSize), route);
95-
respose.LastPage = uriService.GetPageUriString(new PaginationFilter(roundedTotalPages, pageSize), route);
96-
respose.TotalPages = roundedTotalPages;
97-
respose.TotalRecords = totalRecords;
9885

99-
return respose;
86+
public StatsPagedResponse<IEnumerable<T>> CreateStatsPagedReponse<T>(IEnumerable<T> pagedData, PaginationFilter validFilter, long totalRecords, IUriService uriService, string route)
87+
{
88+
var response = new StatsPagedResponse<IEnumerable<T>>(pagedData, validFilter.PageNumber, validFilter.PageSize.Value);
89+
response.SetUp(validFilter, totalRecords, uriService, route);
90+
return response;
10091
}
10192
}
10293
}

src/WorkflowManager/WorkflowManager/Filter/PaginationFilter.cs renamed to src/Shared/Shared/Filter/PaginationFilter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 MONAI Consortium
2+
* Copyright 2023 MONAI Consortium
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
namespace Monai.Deploy.WorkflowManager.Filter
17+
namespace Monai.Deploy.WorkflowManager.Shared.Filter
1818
{
1919
/// <summary>
2020
/// Pagination Filter class.

src/Shared/Shared/Monai.Deploy.WorkflowManager.Shared.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="6.0.15" />
5252
</ItemGroup>
5353

54+
<ItemGroup>
55+
<ProjectReference Include="..\Configuration\Monai.Deploy.WorkflowManager.Configuration.csproj" />
56+
</ItemGroup>
57+
5458
<PropertyGroup>
5559
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
5660
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>

src/WorkflowManager/WorkflowManager/Services/IUriService.cs renamed to src/Shared/Shared/Services/IUriService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 MONAI Consortium
2+
* Copyright 2023 MONAI Consortium
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
using Monai.Deploy.WorkflowManager.Filter;
17+
using Monai.Deploy.WorkflowManager.Shared.Filter;
1818

19-
namespace Monai.Deploy.WorkflowManager.Services
19+
namespace Monai.Deploy.WorkflowManager.Shared.Services
2020
{
2121
/// <summary>
2222
/// Uri Serivce.

0 commit comments

Comments
 (0)