Skip to content

Commit 1b39059

Browse files
authored
Merge pull request #466 from Project-MONAI/AI94-nds-logging
change to logging
2 parents 6d2cf96 + c9c584c commit 1b39059

File tree

118 files changed

+574
-339
lines changed

Some content is hidden

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

118 files changed

+574
-339
lines changed

src/Api/GlobalSuppressions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2022 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+
17+
// This file is used by Code Analysis to maintain SuppressMessage
18+
// attributes that are applied to this project.
19+
// Project-level suppressions either have no target or are given
20+
// a specific target and scoped to a namespace, type, member, etc.
21+
22+
using System.Diagnostics.CodeAnalysis;
23+
24+
[assembly: SuppressMessage("Sonar Code Smell", "S2094: Remove this empty class, write its code or make it an \"interface\"", Justification = "placeholder code")]

src/Api/SourceApplicationEntity.cs

100644100755
File mode changed.

src/Api/Storage/FileStorageMetadata.cs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public abstract record FileStorageMetadata
6969
/// Gets or sets the data origin of this file.
7070
/// </summary>
7171
[JsonPropertyName("dataOrigin"), JsonInclude]
72-
public DataOrigin DataOrigin { get; private set; }
72+
public DataOrigin DataOrigin { get; private set; } = new();
7373

7474
/// <summary>
7575
/// Gets a list of workflows designated for the file.
@@ -162,4 +162,4 @@ public static string IpAddress()
162162
return "127.0.0.1";
163163
}
164164
}
165-
}
165+
}

src/Api/Storage/StorageObjectMetadata.cs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class StorageObjectMetadata
4040
/// Gets the file extension.
4141
/// </summary>
4242
[JsonPropertyName("fileExtension")]
43-
public string FileExtension { get; init; } = default!;
43+
public string FileExtension { get; init; }
4444

4545
/// <summary>
4646
/// Gets or sets the content type of the file.
@@ -83,7 +83,7 @@ public class StorageObjectMetadata
8383
/// Gets or sets whether upload failed.
8484
/// </summary>
8585
[JsonPropertyName("isUploadFailed"), JsonInclude]
86-
public bool IsUploadFailed { get; private set; } = default!;
86+
public bool IsUploadFailed { get; private set; }
8787

8888
[JsonPropertyName("isMoveCompleted"), JsonInclude]
8989
public bool IsMoveCompleted { get; private set; } = default!;

src/CLI/Services/DockerRunner.cs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public async Task<RunnerState> IsApplicationRunning(ImageVersion imageVersion, C
6464
return new RunnerState { IsRunning = false };
6565
}
6666

67-
return new RunnerState { IsRunning = true, Id = matches.First().ID };
67+
return new RunnerState { IsRunning = true, Id = matches[0].ID };
6868
}
6969

7070
public async Task<ImageVersion> GetLatestApplicationVersion(CancellationToken cancellationToken = default)
@@ -98,7 +98,7 @@ public async Task<IList<ImageVersion>> GetApplicationVersions(string version, Ca
9898
};
9999
_logger.RetrievingImagesFromDocker();
100100
var images = await _dockerClient.Images.ListImagesAsync(parameters, cancellationToken).ConfigureAwait(false);
101-
return images?.Select(p => new ImageVersion { Version = p.RepoTags.First(), Id = p.ID, Created = p.Created }).ToList();
101+
return images?.Select(p => new ImageVersion { Version = p.RepoTags[0], Id = p.ID, Created = p.Created }).ToList();
102102
}
103103

104104
public async Task<bool> StartApplication(ImageVersion imageVersion, CancellationToken cancellationToken = default)

src/CLI/Services/NLogConfigurationOptionAccessor.cs

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public interface INLogConfigurationOptionAccessor
3030

3131
public class NLogConfigurationOptionAccessor : INLogConfigurationOptionAccessor
3232
{
33+
public const string NlogSchema = "http://www.nlog-project.org/schemas/NLog.xsd";
3334
private readonly XmlDocument _xmlDocument;
3435
private readonly XmlNamespaceManager _namespaceManager;
3536

@@ -44,7 +45,7 @@ public NLogConfigurationOptionAccessor(IFileSystem fileSystem)
4445
_xmlDocument = new XmlDocument();
4546
_xmlDocument.LoadXml(xml);
4647
_namespaceManager = new XmlNamespaceManager(_xmlDocument.NameTable);
47-
_namespaceManager.AddNamespace("ns", "http://www.nlog-project.org/schemas/NLog.xsd");
48+
_namespaceManager.AddNamespace("ns", NlogSchema);
4849
}
4950

5051
public string LogStoragePath

src/Client.Common/UriExtensions.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static Uri EnsureUriEndsWithSlash(this Uri input)
2828

2929
var str = input.ToString();
3030

31-
if (!string.IsNullOrWhiteSpace(str) && !str.EndsWith("/"))
31+
if (!string.IsNullOrWhiteSpace(str) && !str.EndsWith('/'))
3232
{
3333
#pragma warning disable S1075 // URIs should not be hardcoded
3434
return new Uri(str + '/');

src/Client/HttpContentExtensions.cs

100644100755
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ internal static class HttpContentExtensions
2424
{
2525
public static async System.Threading.Tasks.Task<T> ReadAsAsync<T>(this HttpContent httpContent, CancellationToken cancellationToken)
2626
{
27-
var json = await httpContent.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
2827
using (var contentStream = await httpContent.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false))
2928
{
3029
return await JsonSerializer.DeserializeAsync<T>(contentStream, Configuration.JsonSerializationOptions, cancellationToken: cancellationToken).ConfigureAwait(false);

src/Client/Test/packages.lock.json

100644100755
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,7 @@
18271827
"Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )",
18281828
"Monai.Deploy.InformaticsGateway.Database.EntityFramework": "[1.0.0, )",
18291829
"Monai.Deploy.InformaticsGateway.DicomWeb.Client": "[1.0.0, )",
1830+
"Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution": "[1.0.0, )",
18301831
"Monai.Deploy.Messaging.RabbitMQ": "[1.0.0, )",
18311832
"Monai.Deploy.Security": "[0.1.3, )",
18321833
"Monai.Deploy.Storage.MinIO": "[0.2.18, )",
@@ -1889,7 +1890,8 @@
18891890
"type": "Project",
18901891
"dependencies": {
18911892
"Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )",
1892-
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )"
1893+
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )",
1894+
"NLog": "[5.2.3, )"
18931895
}
18941896
},
18951897
"monai.deploy.informaticsgateway.database.entityframework": {
@@ -1921,6 +1923,23 @@
19211923
"System.Linq.Async": "[6.0.1, )",
19221924
"fo-dicom": "[5.1.1, )"
19231925
}
1926+
},
1927+
"monai.deploy.informaticsgateway.plugins.remoteappexecution": {
1928+
"type": "Project",
1929+
"dependencies": {
1930+
"Microsoft.EntityFrameworkCore": "[6.0.21, )",
1931+
"Microsoft.EntityFrameworkCore.Relational": "[6.0.21, )",
1932+
"Microsoft.EntityFrameworkCore.Sqlite": "[6.0.21, )",
1933+
"Microsoft.Extensions.Configuration": "[6.0.1, )",
1934+
"Microsoft.Extensions.Configuration.FileExtensions": "[6.0.0, )",
1935+
"Microsoft.Extensions.Configuration.Json": "[6.0.0, )",
1936+
"Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )",
1937+
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )",
1938+
"Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )",
1939+
"MongoDB.Driver": "[2.21.0, )",
1940+
"NLog": "[5.2.3, )",
1941+
"Polly": "[7.2.4, )"
1942+
}
19241943
}
19251944
}
19261945
}

src/Configuration/ConfigurationValidator.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private bool IsValidDirectory(string source, string directory)
120120
private bool IsValidBucketName(string source, string bucketName)
121121
{
122122
var valid = IsNotNullOrWhiteSpace(source, bucketName);
123-
var regex = new Regex("(?=^.{3,63}$)(^[a-z0-9]+[a-z0-9\\-]+[a-z0-9]+$)", new RegexOptions(), TimeSpan.FromSeconds(5));
123+
var regex = new Regex("(?=^.{3,63}$)(^[a-z0-9]+[a-z0-9\\-]+[a-z0-9]+$)", RegexOptions.None, TimeSpan.FromSeconds(5));
124124
if (!regex.IsMatch(bucketName))
125125
{
126126
valid = false;

0 commit comments

Comments
 (0)