Skip to content

Commit

Permalink
add more comments to join routine
Browse files Browse the repository at this point in the history
  • Loading branch information
VerstraeteBert committed Apr 5, 2024
1 parent 00ec92c commit ef24271
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public boolean execute(
for (String joinOnRef : joinOn) {
TaskModel forkedTask = workflow.getTaskByRefName(joinOnRef);
if (forkedTask == null) {
// Task is not even scheduled yet
// Continue checking other tasks if a referenced task is not yet scheduled
continue;
}

Expand All @@ -68,6 +68,9 @@ public boolean execute(
task.addOutput(joinOnRef, forkedTask.getOutputData());
}

// Determine if the join task fails immediately due to a non-optional, non-permissive
// task failure,
// or waits for all tasks to be terminal if the failed task is permissive.
var isJoinFailure =
!taskStatus.isSuccessful()
&& !forkedTask.getWorkflowTask().isOptional()
Expand Down Expand Up @@ -98,6 +101,7 @@ public boolean execute(
}
}

// Finalize the join task's status based on the outcomes of all referenced tasks.
if (allTasksTerminal) {
if (!optionalTaskFailures.isEmpty()) {
task.setStatus(TaskModel.Status.COMPLETED_WITH_ERRORS);
Expand All @@ -109,6 +113,7 @@ public boolean execute(
return true;
}

// Task execution not complete, waiting on more tasks to reach terminal state.
return false;
}

Expand Down

0 comments on commit ef24271

Please sign in to comment.