Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Continue WaitFor loop if tasks are not failed #6572

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion core/src/main/java/io/kestra/plugin/core/flow/WaitFor.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public boolean childTaskRunExecuted(Execution execution, TaskRun parentTaskRun)
.stream()
.filter(t -> t.getParentTaskRunId() != null
&& t.getParentTaskRunId().equals(parentTaskRun.getId())
&& t.getState().isSuccess()
&& t.getState().isTerminated()
).count() == tasks.size();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public abstract class AbstractRunnerTest {
protected ForEachItemCaseTest forEachItemCaseTest;

@Inject
private WaitForCaseTest waitForTestCaseTest;
protected WaitForCaseTest waitForTestCaseTest;

@Inject
private FlowConcurrencyCaseTest flowConcurrencyCaseTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@ public void waitforMultipleTasksFailed() throws TimeoutException, QueueException
assertThat(execution.getState().getCurrent(), is(State.Type.FAILED));
assertThat(execution.getTaskRunList().getLast().attemptNumber(), is(1));
}

public void waitForChildTaskWarning() throws TimeoutException, QueueException {
Execution execution = runnerUtils.runOne(null, "io.kestra.tests", "waitfor-child-task-warning");

assertThat(execution.getState().getCurrent(), is(State.Type.FAILED));
assertThat(execution.getTaskRunList().getLast().attemptNumber(), greaterThan(1));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
id: waitfor-child-task-warning
namespace: io.kestra.tests

tasks:
- id: loop
type: io.kestra.plugin.core.flow.WaitFor
condition: "{{ outputs.check_migration_task.values['test'] == 'FINISHED' }}"
failOnMaxReached: true
checkFrequency:
interval: PT5S
maxDuration: PT10S
tasks:

## forcing a Warning
- id: allow_failure
allowFailure: true
type: io.kestra.plugin.core.execution.Fail

- id: check_migration_task
type: io.kestra.plugin.core.output.OutputValues
values:
test: "ok"
6 changes: 6 additions & 0 deletions jdbc/src/test/java/io/kestra/jdbc/runner/JdbcRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public abstract class JdbcRunnerTest extends AbstractRunnerTest {
@Inject
private JdbcTestUtils jdbcTestUtils;

@Test
@LoadFlows({"flows/valids/waitfor-child-task-warning.yaml"})
void waitForChildTaskWarning() throws Exception {
waitForTestCaseTest.waitForChildTaskWarning();
}

@Test
@LoadFlows({"flows/valids/inputs-large.yaml"})
void flowTooLarge() throws Exception {
Expand Down
Loading