Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -575,3 +575,4 @@ GitExtensions.settings.backup
*.feature.cs
*.AssemblyHooks.cs
*.AssemblyHooks.vb
/src/WorkflowManager/mc.exe
28 changes: 28 additions & 0 deletions guidelines/mwm-developer-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
~ Copyright 2022 MONAI Consortium
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

# Developer local setup

## assumptions
you have kubernetes running locally either via Docker desktop or microk8s (or similar)


### steps
- following the qickstart here https://argoproj.github.io/argo-workflows/quick-start/ but change to namespace to suit. ie

- - `kubectl create ns minio`
- - `kubectl apply -n minio -f https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start-postgres.yaml`

7 changes: 7 additions & 0 deletions guidelines/mwm-workflow-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ The Task's "args" object should contain the following fields:
|------|------|------|------|
|workflow_id|str|Yes|The ID of this workflow as registered on the Argo server.|
|server_url|url|Yes|The URL of the Argo server.|
|allow_insecure|bool|No|Allow insecure connections to argo from the plug-in.|
|messaging_endpoint|url|Yes|Address for RabbitMq, used for a callback message at the end of the Argo workflow.|
|messaging_username|str|No|The username for RabbitMq.|
|messaging_password|str|No|The password for RabbitMq.|
|messaging_topic|str|No|The topic to post to ie. md.tasks.callback.|
|messaging_exchange|str|No|The exchange to post to. ie monaideploy.|
|messaging_vhost|str|No|The vhost to post to. ie monaideploy.|
|parameters|dictionary|No|Key value pairs, Argo parameters that will be passed on to the Argo workflow.|
|priority_class|string|No|The name of a valid Kubernetes priority class to be assigned to the Argo workflow pods|
|resources|object|No|A resource requests & limits object (see below). These will be applied to the Argo workflow pods|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.0-rc0009" />
<PackageReference Include="Monai.Deploy.Storage.MinIO" Version="0.2.0-rc0009" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Monai.Deploy.Storage.MinIO" Version="0.1.0" />
<PackageReference Include="Monai.Deploy.Messaging.RabbitMQ" Version="0.1.3-rc0010" />
<PackageReference Include="Monai.Deploy.Storage" Version="0.1.1" />
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.3-rc0010" />
<PackageReference Include="System.IO.Abstractions" Version="17.0.18" />
</ItemGroup>
Expand Down
22 changes: 11 additions & 11 deletions src/Configuration/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@
},
"Monai.Deploy.Storage": {
"type": "Direct",
"requested": "[0.1.1, )",
"resolved": "0.1.1",
"contentHash": "v5VrUSlYPzZf7tVyeFwD30QjspPfW6XBp7AQw5MmFC0PNF5CEn47UDb3sy7869ByN+rpwC2iDIr0yq+xqVNEOw==",
"requested": "[0.2.0-rc0009, )",
"resolved": "0.2.0-rc0009",
"contentHash": "YOdGLuSQwR4QtktmIhpee/+gNs5cgGGBYax9xLun7kr1Og751v12aH33Fn2Vu88L3gDvYGMkB/2UjdI0k61ldQ==",
"dependencies": {
"AWSSDK.SecurityToken": "3.7.1.165",
"Ardalis.GuardClauses": "4.0.1",
"Microsoft.Extensions.Configuration": "6.0.1",
"Microsoft.Extensions.Logging": "6.0.0",
"Monai.Deploy.Storage.S3Policy": "0.1.1",
"Monai.Deploy.Storage.S3Policy": "0.2.0-rc0009",
"System.IO.Abstractions": "17.0.18"
}
},
"Monai.Deploy.Storage.MinIO": {
"type": "Direct",
"requested": "[0.1.0, )",
"resolved": "0.1.0",
"contentHash": "IEqw1ugxsNRDAUkNRoq41fcKmw3C2uYTLzcWdPhnmFe6iRqTQj3nex8nTivp7kcOtKBjdn1UAYdIldTRnHqcpg==",
"requested": "[0.2.0-rc0009, )",
"resolved": "0.2.0-rc0009",
"contentHash": "muor/mSIGF72HK3nQdLHNa7k468p5BcnC0rkVe/FtBH4H82UpIgMuY8SoauF9L+HgRS2U2d0W1HPoNfqusp+MQ==",
"dependencies": {
"AWSSDK.SecurityToken": "3.7.1.165",
"Ardalis.GuardClauses": "4.0.1",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Options": "6.0.0",
"Minio": "4.0.4",
"Monai.Deploy.Storage": "0.1.0",
"Monai.Deploy.Storage.S3Policy": "0.1.0"
"Monai.Deploy.Storage": "0.2.0-rc0009",
"Monai.Deploy.Storage.S3Policy": "0.2.0-rc0009"
}
},
"Newtonsoft.Json": {
Expand Down Expand Up @@ -199,8 +199,8 @@
},
"Monai.Deploy.Storage.S3Policy": {
"type": "Transitive",
"resolved": "0.1.1",
"contentHash": "viswzSf0taoDw2FWoAw8iTC/AX0cay1wViCziziySB5qOZ4VXiGorOAX+z23+itT56ZiZc1xeyDOvJWJBrZltQ==",
"resolved": "0.2.0-rc0009",
"contentHash": "IgiC87hJJLP+azRiLcJVD7Vqb6pfU36enhDgoUJT+YSFdhAFCrGAiPsYOyGc3NiH+YsEhxbUTJhJm3O3Mx4PMA==",
"dependencies": {
"Ardalis.GuardClauses": "4.0.1",
"Newtonsoft.Json": "13.0.1"
Expand Down
20 changes: 10 additions & 10 deletions src/Contracts/Models/Payload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@ namespace Monai.Deploy.WorkflowManager.Contracts.Models
public class Payload
{
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
public string Id { get; set; } = string.Empty;

[JsonProperty(PropertyName = "payload_id")]
public string PayloadId { get; set; }
public string PayloadId { get; set; } = string.Empty;

[JsonProperty(PropertyName = "workflows")]
public IEnumerable<string> Workflows { get; set; }
public IEnumerable<string> Workflows { get; set; } = new List<string>();

[JsonProperty(PropertyName = "workflow_instance_ids")]
public IEnumerable<string> WorkflowInstanceIds { get; set; }
public IEnumerable<string> WorkflowInstanceIds { get; set; } = new List<string>();

[JsonProperty(PropertyName = "file_count")]
public int FileCount { get; set; }

[JsonProperty(PropertyName = "correlation_id")]
public string CorrelationId { get; set; }
public string CorrelationId { get; set; } = string.Empty;

[JsonProperty(PropertyName = "bucket")]
public string Bucket { get; set; }
public string Bucket { get; set; } = string.Empty;

[JsonProperty(PropertyName = "calling_aetitle")]
public string CallingAeTitle { get; set; }
public string CallingAeTitle { get; set; } = string.Empty;

[JsonProperty(PropertyName = "called_aetitle")]
public string CalledAeTitle { get; set; }
public string CalledAeTitle { get; set; } = string.Empty;

[JsonProperty(PropertyName = "timestamp")]
public DateTime Timestamp { get; set; }

[JsonProperty(PropertyName = "files")]
public IList<BlockStorageInfo> Files { get; set; }
public IList<BlockStorageInfo> Files { get; set; } = new List<BlockStorageInfo>();

[JsonProperty(PropertyName = "patient_details")]
public PatientDetails PatientDetails { get; set; }
public PatientDetails PatientDetails { get; set; } = new PatientDetails();
}
}
17 changes: 8 additions & 9 deletions src/Contracts/Models/TaskObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,27 @@ namespace Monai.Deploy.WorkflowManager.Contracts.Models
public class TaskObject
{
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
public string Id { get; set; } = string.Empty;

[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
public string Description { get; set; } = string.Empty;

[JsonProperty(PropertyName = "type")]
public string Type { get; set; }
public string Type { get; set; } = string.Empty;

[JsonProperty(PropertyName = "args")]
public Dictionary<string, string> Args { get; set; }
public Dictionary<string, string> Args { get; set; } = new Dictionary<string, string>();

[JsonProperty(PropertyName = "ref")]
public string Ref { get; set; }

public string Ref { get; set; } = string.Empty;
[JsonProperty(PropertyName = "task_destinations")]
public TaskDestination[] TaskDestinations { get; set; }
public TaskDestination[] TaskDestinations { get; set; } = System.Array.Empty<TaskDestination>();

[JsonProperty(PropertyName = "export_destinations")]
public TaskDestination[] ExportDestinations { get; set; }
public TaskDestination[] ExportDestinations { get; set; } = System.Array.Empty<TaskDestination>();

[JsonProperty(PropertyName = "artifacts")]
public ArtifactMap Artifacts { get; set; }
public ArtifactMap Artifacts { get; set; } = new ArtifactMap();

[JsonProperty(PropertyName = "input_parameters")]
public Dictionary<string, object>? InputParameters { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Monai.Deploy.WorkflowManager.Contracts</RootNamespace>
<CodeAnalysisRuleSet></CodeAnalysisRuleSet>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Database/Monai.Deploy.WorkflowManager.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Monai.Deploy.WorkflowManager.Database</RootNamespace>
<CodeAnalysisRuleSet></CodeAnalysisRuleSet>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="Monai.Deploy.Storage.MinIO" Version="0.1.0" />
<PackageReference Include="Monai.Deploy.Storage.MinIO" Version="0.2.0-rc0009" />
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 10 additions & 10 deletions src/Monai.Deploy.WorkflowManager.Storage/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
},
"Monai.Deploy.Storage.MinIO": {
"type": "Direct",
"requested": "[0.1.0, )",
"resolved": "0.1.0",
"contentHash": "IEqw1ugxsNRDAUkNRoq41fcKmw3C2uYTLzcWdPhnmFe6iRqTQj3nex8nTivp7kcOtKBjdn1UAYdIldTRnHqcpg==",
"requested": "[0.2.0-rc0009, )",
"resolved": "0.2.0-rc0009",
"contentHash": "muor/mSIGF72HK3nQdLHNa7k468p5BcnC0rkVe/FtBH4H82UpIgMuY8SoauF9L+HgRS2U2d0W1HPoNfqusp+MQ==",
"dependencies": {
"AWSSDK.SecurityToken": "3.7.1.165",
"Ardalis.GuardClauses": "4.0.1",
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Options": "6.0.0",
"Minio": "4.0.4",
"Monai.Deploy.Storage": "0.1.0",
"Monai.Deploy.Storage.S3Policy": "0.1.0"
"Monai.Deploy.Storage": "0.2.0-rc0009",
"Monai.Deploy.Storage.S3Policy": "0.2.0-rc0009"
}
},
"AWSSDK.Core": {
Expand Down Expand Up @@ -170,21 +170,21 @@
},
"Monai.Deploy.Storage": {
"type": "Transitive",
"resolved": "0.1.0",
"contentHash": "BA9MH3EoFuyOGym/Wy28sFlOW5PGtHSmo83xXwHeXJE1V0lcmTn30ZiSjzDK77hvHUb04TJRL3pvcXMKpdwK2Q==",
"resolved": "0.2.0-rc0009",
"contentHash": "YOdGLuSQwR4QtktmIhpee/+gNs5cgGGBYax9xLun7kr1Og751v12aH33Fn2Vu88L3gDvYGMkB/2UjdI0k61ldQ==",
"dependencies": {
"AWSSDK.SecurityToken": "3.7.1.165",
"Ardalis.GuardClauses": "4.0.1",
"Microsoft.Extensions.Configuration": "6.0.1",
"Microsoft.Extensions.Logging": "6.0.0",
"Monai.Deploy.Storage.S3Policy": "0.1.0",
"Monai.Deploy.Storage.S3Policy": "0.2.0-rc0009",
"System.IO.Abstractions": "17.0.18"
}
},
"Monai.Deploy.Storage.S3Policy": {
"type": "Transitive",
"resolved": "0.1.0",
"contentHash": "yITzMBKwppORGoP3BL9f0lVjWodHRqSwuo9Y8huyvhVBto6fF6j42j8bBNg1tgnsz/SI7hjn1TpQIImn709nTA==",
"resolved": "0.2.0-rc0009",
"contentHash": "IgiC87hJJLP+azRiLcJVD7Vqb6pfU36enhDgoUJT+YSFdhAFCrGAiPsYOyGc3NiH+YsEhxbUTJhJm3O3Mx4PMA==",
"dependencies": {
"Ardalis.GuardClauses": "4.0.1",
"Newtonsoft.Json": "13.0.1"
Expand Down
34 changes: 34 additions & 0 deletions src/PayloadListener/Extensions/CollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2022 MONAI Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Monai.Deploy.WorkflowManager.PayloadListener.Extensions
{
/// <summary>
/// Set of useful extensions for collections.
/// </summary>
public static class CollectionExtensions
{
/// <summary>Indicates whether the specified array is null or has a length of zero.</summary>
/// <typeparam name="T">Type.</typeparam>
/// <param name="array">The array to test.</param>
/// <returns>true if the array parameter is null or has a length of zero; otherwise, false.</returns>
/// <returns>true if collection is empty.</returns>
public static bool IsNullOrEmpty<T>(this ICollection<T> array)
{
return array is null || array.Count == 0;
}
}
}
4 changes: 2 additions & 2 deletions src/PayloadListener/Extensions/WorkflowExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ public static bool IsTaskTypeValid(string source, string taskType, IList<string>
return false;
}

public static bool IsArgsValid(string source, object args, IList<string> validationErrors = null)
public static bool IsArgsValid(string source, Dictionary<string, string> args, IList<string> validationErrors = null)
{
Guard.Against.NullOrWhiteSpace(source, nameof(source));

if (args != null) return true;
if (!args.IsNullOrEmpty()) return true;

validationErrors?.Add($"'{args}' is not a valid {nameof(args)} (source: {source}).");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="Monai.Deploy.Storage.MinIO" Version="0.1.0" />
<PackageReference Include="Monai.Deploy.Messaging.RabbitMQ" Version="0.1.3-rc0010" />
<PackageReference Include="Monai.Deploy.Storage" Version="0.1.1" />
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.3-rc0010" />
<PackageReference Include="Monai.Deploy.Storage.MinIO" Version="0.2.0-rc0009" />
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.0-rc0009" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading