Skip to content

Commit 8f0479e

Browse files
committed
[Chore] Fix workflow is offline can be trigger
1 parent c4e2c66 commit 8f0479e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/BackfillWorkflowDTOValidator.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
import lombok.extern.slf4j.Slf4j;
2525

26+
import org.apache.dolphinscheduler.common.enums.CommandType;
27+
import org.apache.dolphinscheduler.common.enums.ReleaseState;
2628
import org.springframework.stereotype.Component;
2729

2830
@Slf4j
@@ -41,5 +43,14 @@ public void validate(final BackfillWorkflowDTO backfillWorkflowDTO) {
4143
if (backfillParams.getExpectedParallelismNumber() < 0) {
4244
throw new IllegalArgumentException("expectedParallelismNumber should >= 0");
4345
}
46+
if (backfillWorkflowDTO.getExecType() != CommandType.COMPLEMENT_DATA) {
47+
throw new IllegalArgumentException("The execType should be START_PROCESS");
48+
}
49+
if (backfillWorkflowDTO.getWorkflowDefinition() == null) {
50+
throw new IllegalArgumentException("The workflowDefinition should not be null");
51+
}
52+
if (backfillWorkflowDTO.getWorkflowDefinition().getScheduleReleaseState() != ReleaseState.ONLINE) {
53+
throw new IllegalStateException("The workflowDefinition should be online");
54+
}
4455
}
4556
}

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/TriggerWorkflowDTOValidator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import lombok.extern.slf4j.Slf4j;
2424

25+
import org.apache.dolphinscheduler.common.enums.ReleaseState;
2526
import org.springframework.stereotype.Component;
2627

2728
@Slf4j
@@ -36,5 +37,8 @@ public void validate(final TriggerWorkflowDTO triggerWorkflowDTO) {
3637
if (triggerWorkflowDTO.getWorkflowDefinition() == null) {
3738
throw new IllegalArgumentException("The workflowDefinition should not be null");
3839
}
40+
if (triggerWorkflowDTO.getWorkflowDefinition().getScheduleReleaseState() != ReleaseState.ONLINE) {
41+
throw new IllegalStateException("The workflowDefinition should be online");
42+
}
3943
}
4044
}

0 commit comments

Comments
 (0)