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
9 changes: 8 additions & 1 deletion src/WorkflowManager/Logging/Logging/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using Amazon.Runtime.Internal;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -152,7 +153,13 @@ public static void LogControllerEndTime(this ILogger logger, ResultExecutedConte
[LoggerMessage(EventId = 33, Level = LogLevel.Debug, Message = "Task destination condition for task {taskId} with condition: {conditions} resolved to false.")]
public static partial void TaskDestinationConditionFalse(this ILogger logger, string conditions, string taskId);

[LoggerMessage(EventId = 34, Level = LogLevel.Debug, Message = "Payload already exists for {payloadId}. This is likley due to being requeued")]
public static void LogArtifactPassing(this ILogger logger, Artifact artifact, string path, string artifactType, bool exists)
{
logger.LogInformation(34, "Artifact Passed data Artifact {artifact}, Path {path}, ArtifactType {artifactType}, Exists {exists}",
JsonConvert.SerializeObject(artifact), path, artifactType, exists);
}

[LoggerMessage(EventId = 35, Level = LogLevel.Debug, Message = "Payload already exists for {payloadId}. This is likley due to being requeued")]
public static partial void PayloadAlreadyExists(this ILogger logger, string payloadId);
}
}
4 changes: 4 additions & 0 deletions src/WorkflowManager/WorkflowExecuter/Common/ArtifactMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ public async Task<Dictionary<string, string>> ConvertArtifactVariablesToPath(Art
{
artifactPathDictionary.Add(mappedArtifact.Key, mappedArtifact.Value);

_logger.LogArtifactPassing(artifact, mappedArtifact.Value, shouldExistYet ? "Input" : "Pre-Task Output Path Mapping", true);

continue;
}

_logger.LogArtifactPassing(artifact, mappedArtifact.Value, shouldExistYet ? "Input" : "Pre-Task Output Path Mapping", false);

if (artifact.Mandatory)
{
throw new FileNotFoundException($"Mandatory artifact was not found: {artifact.Name}, {artifact.Value}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public async Task<bool> ProcessPayload(WorkflowRequestEvent message, Payload pay
var workflowInstances = new List<WorkflowInstance>();

var tasks = workflows.Select(workflow => CreateWorkflowInstanceAsync(message, workflow));
await Task.WhenAll(tasks).ConfigureAwait(false);
workflowInstances.AddRange(tasks.Select(t => t.Result));
var newInstances = await Task.WhenAll(tasks).ConfigureAwait(false);
workflowInstances.AddRange(newInstances);

var existingInstances = await _workflowInstanceRepository.GetByWorkflowsIdsAsync(workflowInstances.Select(w => w.WorkflowId).ToList());

Expand Down Expand Up @@ -423,13 +423,17 @@ private async Task<bool> HandleOutputArtifacts(WorkflowInstance workflowInstance

var validOutputArtifacts = await _storageService.VerifyObjectsExistAsync(workflowInstance.BucketId, artifactDict);

workflowInstance.Tasks?.ForEach(t =>
foreach (var artifact in artifactDict)
{
if (t.TaskId == task.TaskId)
{
t.OutputArtifacts = validOutputArtifacts;
}
});
_logger.LogArtifactPassing(new Artifact { Name = artifact.Key, Value = artifact.Value }, artifact.Value, "Post-Task Output Artifact", validOutputArtifacts.ContainsKey(artifact.Key));
}

var currentTask = workflowInstance.Tasks?.FirstOrDefault(t => t.TaskId == task.TaskId);

if (currentTask is not null)
{
currentTask.OutputArtifacts = validOutputArtifacts;
}

if (validOutputArtifacts is not null && validOutputArtifacts.Any())
{
Expand Down