Skip to content

Commit

Permalink
Merge pull request #922 from Project-MONAI/AI-183
Browse files Browse the repository at this point in the history
Ai 183
  • Loading branch information
neildsouth authored Dec 4, 2023
2 parents f14432a + 1b4851d commit 3e9a443
Show file tree
Hide file tree
Showing 26 changed files with 698 additions and 55 deletions.
3 changes: 3 additions & 0 deletions src/Common/Configuration/ConfigurationValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public bool IsTopicsValid(MessageBrokerConfigurationKeys configurationKeys)
valid &= IsStringValueNotNull(nameof(configurationKeys.WorkflowRequest), configurationKeys.WorkflowRequest);
valid &= IsStringValueNotNull(nameof(configurationKeys.ExportRequestPrefix), configurationKeys.ExportRequestPrefix);
valid &= IsStringValueNotNull(nameof(configurationKeys.TaskDispatchRequest), configurationKeys.TaskDispatchRequest);
valid &= IsStringValueNotNull(nameof(configurationKeys.ExportHL7), configurationKeys.ExportHL7);
valid &= IsStringValueNotNull(nameof(configurationKeys.ExportHL7Complete), configurationKeys.ExportHL7Complete);


return valid;
}
Expand Down
22 changes: 22 additions & 0 deletions src/Common/Configuration/MessageBrokerConfigurationKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ public class MessageBrokerConfigurationKeys
[ConfigurationKeyName("exportComplete")]
public string ExportComplete { get; set; } = "md.export.complete";

/// <summary>
/// Gets or sets the topic for publishing workflow requests.
/// Defaults to `md.export.complete`.
/// </summary>
[ConfigurationKeyName("exportHL7Complete")]
public string ExportHL7Complete { get; set; } = "md.export.hl7complete";

/// <summary>
/// Gets or sets the topic for publishing workflow requests.
/// Defaults to `md.export.request`.
Expand Down Expand Up @@ -98,5 +105,20 @@ public class MessageBrokerConfigurationKeys
/// </summary>
[ConfigurationKeyName("externalAppRequest")]
public string ExternalAppRequest { get; set; } = "md.externalapp.request";

/// <summary>
/// Gets or sets the topic for publishing workflow requests.
/// Defaults to `md.export.request`.
/// </summary>
[ConfigurationKeyName("exportHl7")]
public string ExportHL7 { get; set; } = "md.export.hl7";


/// <summary>
/// Gets or sets the topic for publishing export complete requests.
/// Defaults to `md_export_complete`.
/// </summary>
[ConfigurationKeyName("exportHl7Complete")]
public string ExportHl7Complete { get; set; } = "md.export.hl7complete";
}
}
8 changes: 7 additions & 1 deletion src/Common/Miscellaneous/ValidationConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ public enum NotificationValues
/// </summary>
public const string ExternalAppTaskType = "remote_app_execution";

/// <summary>
/// Key for Hl7 export task type.
/// </summary>
public const string HL7ExportTask = "export_hl7";

/// <summary>
/// Key for the export task type.
/// </summary>
Expand All @@ -141,7 +146,8 @@ public enum NotificationValues
ExportTaskType,
DockerTaskType,
Email,
ExternalAppTaskType
ExternalAppTaskType,
HL7ExportTask
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
<PackageReference Include="Mongo.Migration" Version="3.1.4" />
<PackageReference Include="MongoDB.Bson" Version="2.21.0" />
</ItemGroup>


</Project>
Empty file modified src/TaskManager/API/packages.lock.json
100755 → 100644
Empty file.
Empty file modified src/TaskManager/Database/packages.lock.json
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@
<ItemGroup>
<ProjectReference Include="..\..\Common\Configuration\Monai.Deploy.WorkflowManager.Common.Configuration.csproj" />
<ProjectReference Include="..\..\Common\Miscellaneous\Monai.Deploy.WorkflowManager.Common.Miscellaneous.csproj" />
<ProjectReference Include="..\..\Common\Miscellaneous\Monai.Deploy.WorkflowManager.Common.Miscellaneous.csproj" />
<ProjectReference Include="..\API\Monai.Deploy.WorkflowManager.TaskManager.API.csproj" />
<ProjectReference Include="..\Database\Monai.Deploy.WorkflowManager.TaskManager.Database.csproj" />
<ProjectReference Include="..\Plug-ins\AideClinicalReview\Monai.Deploy.WorkflowManager.TaskManager.AideClinicalReview.csproj">
<TreatAsUsed>true</TreatAsUsed>
</ProjectReference>
<ProjectReference Include="..\Plug-ins\Argo\Monai.Deploy.WorkflowManager.TaskManager.Argo.csproj" />
<ProjectReference Include="..\Plug-ins\Docker\Monai.Deploy.WorkflowManager.TaskManager.Docker.csproj" />
<ProjectReference Include="..\Plug-ins\Email\Monai.Deploy.WorkflowManager.TaskManager.Email.csproj" />
<ProjectReference Include="..\Plug-ins\Email\Monai.Deploy.WorkflowManager.TaskManager.Email.csproj"/>
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/TaskManager/TaskManager/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"aideClinicalReviewCancelation": "aide.clinical_review.cancellation",
"notificationEmailRequest": "aide.notification_email.request",
"notificationEmailCancelation": "aide.notification_email.cancellation",
"exportHl7": "md.export.hl7"
},
"dicomAgents": {
"dicomWebAgentName": "monaidicomweb",
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowManager/Contracts/Constants/TaskTypeConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public static class TaskTypeConstants
{
public const string RouterTask = "router";

public const string ExportTask = "export";
public const string DicomExportTask = "export";

public const string ExternalAppTask = "remote_app_execution";

public const string ExportHl7Task = "export_hl7";
public const string HL7ExportTask = "export_hl7";
}
}
Empty file modified src/WorkflowManager/Database/packages.lock.json
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions src/WorkflowManager/Logging/Log.200000.Workflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,8 @@ public static partial class Log

[LoggerMessage(EventId = 210007, Level = LogLevel.Information, Message = "Exporting to MIG task Id {taskid}, export destination {destination} number of files {fileCount} Mig data plugins {plugins}.")]
public static partial void LogMigExport(this ILogger logger, string taskid, string destination, int fileCount, string plugins);

[LoggerMessage(EventId = 200018, Level = LogLevel.Error, Message = "ExportList or Artifacts are empty! workflowInstanceId {workflowInstanceId} TaskId {taskId}")]

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / task-manager-integration-tests

Multiple logging methods are using event id 200018 in class Log

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / unit-tests-and-codecov

Multiple logging methods are using event id 200018 in class Log

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / unit-tests-and-codecov

Multiple logging methods are using event id 200018 in class Log

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / workflow-executor-integration-tests

Multiple logging methods are using event id 200018 in class Log

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / workflow-executor-integration-tests

Multiple logging methods are using event id 200018 in class Log

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / analyze

Multiple logging methods are using event id 200018 in class Log

Check warning on line 112 in src/WorkflowManager/Logging/Log.200000.Workflow.cs

View workflow job for this annotation

GitHub Actions / docs

Multiple logging methods are using event id 200018 in class Log
public static partial void ExportListOrArtifactsAreEmpty(this ILogger logger, string taskId, string workflowInstanceId);
}
}
7 changes: 7 additions & 0 deletions src/WorkflowManager/Logging/Log.700000.Artifact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,12 @@ public static partial class Log
[LoggerMessage(EventId = 700009, Level = LogLevel.Debug, Message = "Mandatory output artifacts for task {taskId} are missing. waiting for remaining artifacts... {missingArtifacts}")]
public static partial void MandatoryOutputArtifactsMissingForTask(this ILogger logger, string taskId, string missingArtifacts);

[LoggerMessage(EventId = 700010, Level = LogLevel.Debug, Message = "no files exsist in storage {artifactList}")]
public static partial void NoFilesExistInStorage(this ILogger logger, string artifactList);

[LoggerMessage(EventId = 700011, Level = LogLevel.Debug, Message = "adding files to workflowInstance {workflowInstanceId} :Task {taskId} : {artifactList}")]
public static partial void AddingFilesToWorkflowInstance(this ILogger logger, string workflowInstanceId, string taskId, string artifactList);


}
}
Empty file modified src/WorkflowManager/Logging/packages.lock.json
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class PayloadListenerService : IHostedService, IMonaiService, IDisposable
public string TaskStatusUpdateRoutingKey { get; set; }
public string ExportCompleteRoutingKey { get; set; }
public string ArtifactRecievedRoutingKey { get; set; }
public string ExportHL7CompleteRoutingKey { get; set; }
protected int Concurrency { get; set; }
public ServiceStatus Status { get; set; } = ServiceStatus.Unknown;
public string ServiceName => "Payload Listener Service";
Expand All @@ -67,6 +68,7 @@ public PayloadListenerService(
WorkflowRequestRoutingKey = configuration.Value.Messaging.Topics.WorkflowRequest;
ExportCompleteRoutingKey = configuration.Value.Messaging.Topics.ExportComplete;
ArtifactRecievedRoutingKey = configuration.Value.Messaging.Topics.ArtifactRecieved;
ExportHL7CompleteRoutingKey = configuration.Value.Messaging.Topics.ExportHL7Complete;

Concurrency = 2;

Expand Down Expand Up @@ -110,6 +112,9 @@ private void SetupPolling()

_messageSubscriber.SubscribeAsync(ArtifactRecievedRoutingKey, ArtifactRecievedRoutingKey, OnArtifactReceivedtReceivedCallbackAsync);
_logger.EventSubscription(ServiceName, ArtifactRecievedRoutingKey);

_messageSubscriber.SubscribeAsync(ExportHL7CompleteRoutingKey, ExportHL7CompleteRoutingKey, OnExportHL7CompleteReceivedCallback);
_logger.EventSubscription(ServiceName, ExportHL7CompleteRoutingKey);
}

private async Task OnWorkflowRequestReceivedCallbackAsync(MessageReceivedEventArgs eventArgs)
Expand Down Expand Up @@ -156,6 +161,21 @@ private async Task OnExportCompleteReceivedCallback(MessageReceivedEventArgs eve

}

private async Task OnExportHL7CompleteReceivedCallback(MessageReceivedEventArgs eventArgs)
{
using var loggerScope = _logger.BeginScope(new Common.Miscellaneous.LoggingDataDictionary<string, object>
{
["correlationId"] = eventArgs.Message.CorrelationId,
["source"] = eventArgs.Message.ApplicationId,
["messageId"] = eventArgs.Message.MessageId,
["messageDescription"] = eventArgs.Message.MessageDescription,
});

_logger.ExportCompleteReceived();
await _eventPayloadListenerService.ExportCompletePayload(eventArgs);

}

private async Task OnArtifactReceivedtReceivedCallbackAsync(MessageReceivedEventArgs eventArgs)
{

Expand Down
1 change: 1 addition & 0 deletions src/WorkflowManager/PayloadListener/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@
"monai.deploy.workloadmanager.workflowexecuter": {
"type": "Project",
"dependencies": {
"Monai.Deploy.Messaging": "[1.0.5, )",
"Monai.Deploy.WorkflowManager.Common": "[1.0.0, )",
"Monai.Deploy.WorkflowManager.Common.Configuration": "[1.0.0, )",
"Monai.Deploy.WorkflowManager.Common.Miscellaneous": "[1.0.0, )",
Expand Down
Empty file modified src/WorkflowManager/Storage/packages.lock.json
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/WorkflowManager/WorkflowExecuter/Common/ArtifactMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private async Task<KeyValuePair<string, string>> ConvertVariableStringToPath(Art
var artifactName = variableWords[4];
var outputArtifact = task.OutputArtifacts?.FirstOrDefault(a => a.Key == artifactName);

if (!outputArtifact.HasValue)
if (!outputArtifact.HasValue || string.IsNullOrEmpty(outputArtifact.Value.Value))
{
return default;
}
Expand All @@ -203,7 +203,7 @@ private async Task<KeyValuePair<string, string>> VerifyExists(KeyValuePair<strin
if (shouldExistYet)
{
_logger.VerifyArtifactExistence(bucketId, artifact.Key, artifact.Value);
artifact = await _storageService.VerifyObjectExistsAsync(bucketId, artifact.Value) ? artifact : default(KeyValuePair<string, string>);
artifact = await _storageService.VerifyObjectExistsAsync(bucketId, artifact.Value) ? artifact : default;
}

return artifact;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<AdditionalFiles Include="..\..\.sonarlint\project-monai_monai-deploy-workflow-manager\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Monai.Deploy.Messaging" Version="1.0.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Common\Configuration\Monai.Deploy.WorkflowManager.Common.Configuration.csproj" />
<ProjectReference Include="..\..\Common\Miscellaneous\Monai.Deploy.WorkflowManager.Common.Miscellaneous.csproj" />
Expand All @@ -46,6 +50,7 @@
<ProjectReference Include="..\Database\Monai.Deploy.WorkflowManager.Database.csproj" />
<ProjectReference Include="..\Logging\Monai.Deploy.WorkflowManager.Logging.csproj" />
<ProjectReference Include="..\Storage\Monai.Deploy.WorkflowManager.Storage.csproj" />

</ItemGroup>

<PropertyGroup>
Expand Down
Loading

0 comments on commit 3e9a443

Please sign in to comment.