Skip to content

Commit b647d41

Browse files
Update to use new UpdateStatusEvent
Signed-off-by: Jack Schofield <[email protected]>
1 parent 271f282 commit b647d41

File tree

9 files changed

+22
-134
lines changed

9 files changed

+22
-134
lines changed

src/Monai.Deploy.WorkflowManager.sln

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManage
5555
EndProject
5656
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManager.ConditionsResolver.Tests", "..\tests\UnitTests\ConditionsResolver.Tests\Monai.Deploy.WorkflowManager.ConditionsResolver.Tests.csproj", "{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}"
5757
EndProject
58-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManager.TaskManager.API.Tests", "..\tests\UnitTests\TaskManager.API.Tests\Monai.Deploy.WorkflowManager.TaskManager.API.Tests.csproj", "{7AF31246-C97C-4AF5-90C3-422199CF7B4A}"
59-
EndProject
60-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monai.Deploy.WorkflowManager.Common.Tests", "..\tests\UnitTests\WorkflowManager.Common.Tests\Monai.Deploy.WorkflowManager.Common.Tests.csproj", "{A44F975E-70CA-49D6-8513-78F2D5210EAF}"
58+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManager.Common.Tests", "..\tests\UnitTests\WorkflowManager.Common.Tests\Monai.Deploy.WorkflowManager.Common.Tests.csproj", "{A44F975E-70CA-49D6-8513-78F2D5210EAF}"
6159
EndProject
6260
Global
6361
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -161,10 +159,6 @@ Global
161159
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}.Debug|Any CPU.Build.0 = Debug|Any CPU
162160
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}.Release|Any CPU.ActiveCfg = Release|Any CPU
163161
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}.Release|Any CPU.Build.0 = Release|Any CPU
164-
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
165-
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
166-
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
167-
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Release|Any CPU.Build.0 = Release|Any CPU
168162
{A44F975E-70CA-49D6-8513-78F2D5210EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
169163
{A44F975E-70CA-49D6-8513-78F2D5210EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
170164
{A44F975E-70CA-49D6-8513-78F2D5210EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -189,7 +183,6 @@ Global
189183
{89D3D817-CCFE-4933-9089-D1283F2EA1B5} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
190184
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
191185
{A44F975E-70CA-49D6-8513-78F2D5210EAF} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
192-
{7AF31246-C97C-4AF5-90C3-422199CF7B4A} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
193186
EndGlobalSection
194187
GlobalSection(ExtensibilityGlobals) = postSolution
195188
SolutionGuid = {DC0D56C8-D8CB-45CE-B528-F3DCF86D63ED}

src/TaskManager/API/Extensions/StorageListExtensions.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/TaskManager/Plug-ins/Argo/ExitHookTemplate.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using Argo;
55
using Monai.Deploy.Messaging.Events;
6-
using Monai.Deploy.WorkflowManager.TaskManager.API.Extensions;
76
using Newtonsoft.Json;
87

98
namespace Monai.Deploy.WorkflowManager.TaskManager.Argo
@@ -82,7 +81,7 @@ private TaskCallbackEvent GenerateTaskCallbackEvent() =>
8281
ExecutionId = _taskDispatchEvent.ExecutionId,
8382
CorrelationId = _taskDispatchEvent.CorrelationId,
8483
Identity = "{{workflow.name}}",
85-
OutputArtifacts = _taskDispatchEvent.Outputs?.ToArtifactDictionary() ?? new Dictionary<string, string>()
84+
Outputs = _taskDispatchEvent.Outputs ?? new List<Messaging.Common.Storage>()
8685
};
8786

8887
private object GenerateTaskCallbackMessage() =>

src/TaskManager/TaskManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ private void AcknowledgeMessage<T>(JsonMessage<T> message)
312312
}
313313
}
314314

315-
private static JsonMessage<TaskUpdateEvent> GenerateUpdateEventMessage<T>(JsonMessage<T> message, string executionId, string WorkflowInstanceId, string taskId, ExecutionStatus executionStatus, Dictionary<string, string> outputArtifacts = null)
315+
private static JsonMessage<TaskUpdateEvent> GenerateUpdateEventMessage<T>(JsonMessage<T> message, string executionId, string WorkflowInstanceId, string taskId, ExecutionStatus executionStatus, List<Messaging.Common.Storage> outputs = null)
316316
{
317317
Guard.Against.Null(message, nameof(message));
318318
Guard.Against.Null(executionStatus, nameof(executionStatus));
@@ -326,7 +326,7 @@ private static JsonMessage<TaskUpdateEvent> GenerateUpdateEventMessage<T>(JsonMe
326326
WorkflowInstanceId = WorkflowInstanceId,
327327
TaskId = taskId,
328328
Message = executionStatus.Errors,
329-
OutputArtifacts = outputArtifacts ?? new Dictionary<string, string>(),
329+
Outputs = outputs ?? new List<Messaging.Common.Storage>(),
330330
}, TaskManagerApplicationId, message.CorrelationId);
331331
}
332332

src/WorkflowExecuter/Common/EventMapper.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ public static TaskDispatchEvent ToTaskDispatchEvent(TaskExecution task, string w
4444
TaskPluginArguments = task.TaskPluginArguments,
4545
Inputs = inputs,
4646
TaskPluginType = task.TaskType,
47-
Metadata = task.Metadata
47+
Metadata = task.Metadata,
48+
IntermediateStorage = new Messaging.Common.Storage
49+
{
50+
Bucket = configuration.Settings["bucket"],
51+
RelativeRootPath = $"{task.OutputDirectory}/tmp",
52+
Endpoint = configuration.Settings["endpoint"],
53+
Name = task.TaskId,
54+
SecuredConnection = bool.Parse(configuration.Settings["securedConnection"])
55+
}
4856
};
4957
}
5058
}

tests/UnitTests/TaskManager.API.Tests/Extensions/StorageListExtensionsTests.cs

Lines changed: 0 additions & 66 deletions
This file was deleted.

tests/UnitTests/TaskManager.API.Tests/Monai.Deploy.WorkflowManager.TaskManager.API.Tests.csproj

Lines changed: 0 additions & 28 deletions
This file was deleted.

tests/UnitTests/WorkflowExecuter.Tests/Common/EventMapperTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ public void ToTaskDispatchEvent_ValidAeTitleWorkflowRequest_ReturnesTrue()
7171
TaskPluginArguments = new Dictionary<string, string>
7272
{
7373
{ "key", "value" }
74+
},
75+
IntermediateStorage = new Messaging.Common.Storage
76+
{
77+
Bucket = configuration.Settings["bucket"],
78+
Endpoint = configuration.Settings["endpoint"],
79+
Name = task.TaskId,
80+
RelativeRootPath = "minio/workflowid/taskid/tmp",
81+
SecuredConnection = bool.Parse(configuration.Settings["securedConnection"])
7482
}
7583
};
7684

tests/UnitTests/WorkflowExecuter.Tests/Services/WorkflowExecuterServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public WorkflowExecuterServiceTests()
4747
_messageBrokerPublisherService = new Mock<IMessageBrokerPublisherService>();
4848
_storageService = new Mock<IStorageService>();
4949
_configuration = Options.Create(new WorkflowManagerOptions() { Messaging = new MessageBrokerConfiguration { Topics = new MessageBrokerConfigurationKeys { TaskDispatchRequest = "md.task.dispatch" } } });
50-
_storageConfiguration = Options.Create(new StorageServiceConfiguration());
50+
_storageConfiguration = Options.Create(new StorageServiceConfiguration() { Settings = new Dictionary<string, string> { { "bucket", "testbucket" }, { "endpoint", "localhost" }, { "securedConnection", "False" } } });
5151

5252
WorkflowExecuterService = new WorkflowExecuterService(_logger.Object, _configuration, _storageConfiguration, _workflowRepository.Object, _workflowInstanceRepository.Object, _messageBrokerPublisherService.Object, _artifactMapper.Object, _storageService.Object);
5353
}

0 commit comments

Comments
 (0)