Skip to content

Commit e69806b

Browse files
misc fixes
Signed-off-by: Jack Schofield <[email protected]>
1 parent ff47eaf commit e69806b

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

src/Contracts/Models/TaskExecution.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ public class TaskExecution
2828
[JsonProperty(PropertyName = "task_id")]
2929
public string TaskId { get; set; }
3030

31+
[JsonProperty(PropertyName = "previous_task_id")]
32+
public string PreviousTaskId { get; set; }
33+
3134
[JsonProperty(PropertyName = "status")]
3235
public TaskExecutionStatus Status { get; set; }
3336

37+
[JsonProperty(PropertyName = "reason")]
38+
public FailureReason Reason { get; set; }
39+
3440
[JsonProperty(PropertyName = "input_artifacts")]
3541
public Dictionary<string, string> InputArtifacts { get; set; }
3642

src/TaskManager/Plug-ins/AideClinicalReview/Keys.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,8 @@ public class Keys
4242
/// </summary>
4343
public static readonly IReadOnlyList<string> RequiredParameters =
4444
new List<string> {
45-
PatientId,
46-
PatientName,
47-
PatientSex,
48-
PatientDob,
4945
QueueName,
50-
WorkflowName,
51-
ReviewedTaskDetails
46+
WorkflowName
5247
};
5348
}
5449
}

src/TaskManager/TaskManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ private async Task HandleTaskCallback(JsonMessage<TaskCallbackEvent> message)
166166
var executionStatus = await runner.Runner.GetStatus(message.Body.Identity, _cancellationTokenSource.Token).ConfigureAwait(false);
167167
updateMessage = GenerateUpdateEventMessage(message, message.Body.ExecutionId, message.Body.WorkflowInstanceId, message.Body.TaskId, executionStatus);
168168
updateMessage.Body.Metadata.Add(Strings.JobIdentity, message.Body.Identity);
169+
foreach (var item in message.Body.Metadata)
170+
updateMessage.Body.Metadata.Add(item.Key, item.Value);
169171
}
170172
catch (Exception ex)
171173
{

src/WorkflowExecuter/Services/WorkflowExecuterService.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ public async Task<bool> ProcessTaskUpdate(TaskUpdateEvent message)
176176
return false;
177177
}
178178

179-
if (message.ExecutionStats is not null)
179+
if (message.ExecutionStats is not null
180+
|| message.Reason != FailureReason.None)
180181
{
181182
currentTask.ExecutionStats = message.ExecutionStats;
183+
currentTask.Reason = message.Reason;
182184
await _workflowInstanceRepository.UpdateTaskAsync(workflowInstance.Id, currentTask.TaskId, currentTask);
183185
}
184186

@@ -414,7 +416,7 @@ private async Task<List<TaskExecution>> CreateTaskDestinations(WorkflowInstance
414416
continue;
415417
}
416418

417-
newTaskExecutions.Add(await CreateTaskExecutionAsync(newTask, workflowInstance));
419+
newTaskExecutions.Add(await CreateTaskExecutionAsync(newTask, workflowInstance, null, null, taskId));
418420
}
419421

420422
return newTaskExecutions;
@@ -491,7 +493,8 @@ private async Task<WorkflowInstance> CreateWorkflowInstanceAsync(WorkflowRequest
491493
private async Task<TaskExecution> CreateTaskExecutionAsync(TaskObject task,
492494
WorkflowInstance workflowInstance,
493495
string? bucketName = null,
494-
string? payloadId = null)
496+
string? payloadId = null,
497+
string? previousTaskId = null)
495498
{
496499
Guard.Against.Null(workflowInstance, nameof(workflowInstance));
497500

@@ -527,7 +530,8 @@ private async Task<TaskExecution> CreateTaskExecutionAsync(TaskObject task,
527530
InputArtifacts = await _artifactMapper.ConvertArtifactVariablesToPath(task?.Artifacts?.Input ?? new Artifact[] { }, payloadId, workflowInstanceId, bucketName),
528531
OutputDirectory = $"{payloadId}/workflows/{workflowInstanceId}/{executionId}/",
529532
Metadata = { },
530-
InputParameters = newInputParameters
533+
InputParameters = newInputParameters,
534+
PreviousTaskId = previousTaskId
531535
};
532536
}
533537

0 commit comments

Comments
 (0)