Skip to content

Commit

Permalink
Update to use new UpdateStatusEvent
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Schofield <jack.schofield@answerdigital.com>
  • Loading branch information
jackschofield23 committed Jun 9, 2022
1 parent 271f282 commit b647d41
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 134 deletions.
9 changes: 1 addition & 8 deletions src/Monai.Deploy.WorkflowManager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManage
EndProject
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}"
EndProject
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}"
EndProject
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}"
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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -161,10 +159,6 @@ Global
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30}.Release|Any CPU.Build.0 = Release|Any CPU
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AF31246-C97C-4AF5-90C3-422199CF7B4A}.Release|Any CPU.Build.0 = Release|Any CPU
{A44F975E-70CA-49D6-8513-78F2D5210EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A44F975E-70CA-49D6-8513-78F2D5210EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A44F975E-70CA-49D6-8513-78F2D5210EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -189,7 +183,6 @@ Global
{89D3D817-CCFE-4933-9089-D1283F2EA1B5} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
{918E4DE3-A7BF-4B7F-9B5A-5C36FEFA3C30} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
{A44F975E-70CA-49D6-8513-78F2D5210EAF} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
{7AF31246-C97C-4AF5-90C3-422199CF7B4A} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC0D56C8-D8CB-45CE-B528-F3DCF86D63ED}
Expand Down
26 changes: 0 additions & 26 deletions src/TaskManager/API/Extensions/StorageListExtensions.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/TaskManager/Plug-ins/Argo/ExitHookTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using Argo;
using Monai.Deploy.Messaging.Events;
using Monai.Deploy.WorkflowManager.TaskManager.API.Extensions;
using Newtonsoft.Json;

namespace Monai.Deploy.WorkflowManager.TaskManager.Argo
Expand Down Expand Up @@ -82,7 +81,7 @@ public Template2 GenerateMessageTemplate(S3Artifact2 artifact)
ExecutionId = _taskDispatchEvent.ExecutionId,
CorrelationId = _taskDispatchEvent.CorrelationId,
Identity = "{{workflow.name}}",
OutputArtifacts = _taskDispatchEvent.Outputs?.ToArtifactDictionary() ?? new Dictionary<string, string>()
Outputs = _taskDispatchEvent.Outputs ?? new List<Messaging.Common.Storage>()
};

private object GenerateTaskCallbackMessage() =>
Expand Down
4 changes: 2 additions & 2 deletions src/TaskManager/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private void AcknowledgeMessage<T>(JsonMessage<T> message)
}
}

private static JsonMessage<TaskUpdateEvent> GenerateUpdateEventMessage<T>(JsonMessage<T> message, string executionId, string WorkflowInstanceId, string taskId, ExecutionStatus executionStatus, Dictionary<string, string> outputArtifacts = null)
private static JsonMessage<TaskUpdateEvent> GenerateUpdateEventMessage<T>(JsonMessage<T> message, string executionId, string WorkflowInstanceId, string taskId, ExecutionStatus executionStatus, List<Messaging.Common.Storage> outputs = null)
{
Guard.Against.Null(message, nameof(message));
Guard.Against.Null(executionStatus, nameof(executionStatus));
Expand All @@ -326,7 +326,7 @@ private static JsonMessage<TaskUpdateEvent> GenerateUpdateEventMessage<T>(JsonMe
WorkflowInstanceId = WorkflowInstanceId,
TaskId = taskId,
Message = executionStatus.Errors,
OutputArtifacts = outputArtifacts ?? new Dictionary<string, string>(),
Outputs = outputs ?? new List<Messaging.Common.Storage>(),
}, TaskManagerApplicationId, message.CorrelationId);
}

Expand Down
10 changes: 9 additions & 1 deletion src/WorkflowExecuter/Common/EventMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ public static TaskDispatchEvent ToTaskDispatchEvent(TaskExecution task, string w
TaskPluginArguments = task.TaskPluginArguments,
Inputs = inputs,
TaskPluginType = task.TaskType,
Metadata = task.Metadata
Metadata = task.Metadata,
IntermediateStorage = new Messaging.Common.Storage
{
Bucket = configuration.Settings["bucket"],
RelativeRootPath = $"{task.OutputDirectory}/tmp",
Endpoint = configuration.Settings["endpoint"],
Name = task.TaskId,
SecuredConnection = bool.Parse(configuration.Settings["securedConnection"])
}
};
}
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public void ToTaskDispatchEvent_ValidAeTitleWorkflowRequest_ReturnesTrue()
TaskPluginArguments = new Dictionary<string, string>
{
{ "key", "value" }
},
IntermediateStorage = new Messaging.Common.Storage
{
Bucket = configuration.Settings["bucket"],
Endpoint = configuration.Settings["endpoint"],
Name = task.TaskId,
RelativeRootPath = "minio/workflowid/taskid/tmp",
SecuredConnection = bool.Parse(configuration.Settings["securedConnection"])
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public WorkflowExecuterServiceTests()
_messageBrokerPublisherService = new Mock<IMessageBrokerPublisherService>();
_storageService = new Mock<IStorageService>();
_configuration = Options.Create(new WorkflowManagerOptions() { Messaging = new MessageBrokerConfiguration { Topics = new MessageBrokerConfigurationKeys { TaskDispatchRequest = "md.task.dispatch" } } });
_storageConfiguration = Options.Create(new StorageServiceConfiguration());
_storageConfiguration = Options.Create(new StorageServiceConfiguration() { Settings = new Dictionary<string, string> { { "bucket", "testbucket" }, { "endpoint", "localhost" }, { "securedConnection", "False" } } });

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

0 comments on commit b647d41

Please sign in to comment.