Hou-Shuaishuai commented on issue #9641:
URL:
https://github.com/apache/dolphinscheduler/issues/9641#issuecomment-1109704629
Since the dependency has an option like the previous 7 days, the logic of
the dependency executed in the previous 7 days should be different from the
logic executed after 7 days.
eg:
On day 1, the judgment dependency returns success
On day 2, only the dependencies executed on the previous 1 day are
judged
On day 3, only the dependencies executed in the previous 2 days are
judged
...
On day 7, only the dependencies executed in the previous 6 days are
judged
On day 8, only the dependencies executed in the previous 7 days are
judged
On day 9, only the dependencies executed in the previous 7 days are
judged
...
To sum up, only the dependence after the execution time of the first
scheduling is judged
1. Update update_time in t_ds_schedules both online and offline
2. When determining the dependency status, if it is found to be
'self-dependency', the first scheduling execution time after scheduling update
is obtained: 'firstScheduleFireTime'. Then go through all the dependent dates
you need to determine: 'dateIntervals', and delete the dependent dates whose
'startTime' is smaller than 'firstScheduleFireTime'
3. If dateIntervals is empty that is the first execution, return success
Logic
code:org.apache.dolphinscheduler.server.utils.DependentExecute.getDependentResultForItem
Method
```java
private DependResult getDependentResultForItem(DependentItem
dependentItem, Date currentTime) {
List<DateInterval> dateIntervals =
DependentUtils.getDateIntervalList(currentTime, dependentItem.getDateValue());
if (isSelfDep()){
Date firstScheduleFireTime = getScheduleFirstFireTime();
removeFirstScheduleFireTimeBreforeInterval(dateIntervals,
firstScheduleFireTime);
if(dateIntervals.isEmpty()){
return DependResult.SUCCESS;
}
}
return calculateResultForTasks(dependentItem, dateIntervals);
}
//TODO delete the dependent dates whose 'startTime'is smaller than
'firstScheduleFireTime'
private void
removeFirstScheduleFireTimeBreforeInterval(List<DateInterval> dateIntervals,
Date firstScheduleFireTime) {
Iterator<DateInterval> iterator = dateIntervals.iterator();
while (iterator.hasNext()) {
if (iterator.next().getStartTime().after(firstScheduleFireTime) {
iterator.remove();
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]