You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "ruanwenjun (via GitHub)" <gi...@apache.org> on 2023/10/11 05:59:29 UTC
Re: [PR] [Improvement][Master] Calculate the remainTime then we set the delay execution. [dolphinscheduler]
ruanwenjun commented on code in PR #15012:
URL: https://github.com/apache/dolphinscheduler/pull/15012#discussion_r1354137848
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/rpc/LogicITaskInstanceDispatchOperationFunction.java:
##########
@@ -62,19 +62,23 @@ public LogicTaskDispatchResponse operate(LogicTaskDispatchRequest taskDispatchRe
LogUtils.setTaskInstanceLogFullPathMDC(taskExecutionContext.getLogPath());
MasterTaskExecutionContextHolder.putTaskExecutionContext(taskExecutionContext);
- // todo: calculate the delay in master dispatcher then we don't need to use a queue to store the task
- final long remainTime =
- DateUtils.getRemainTime(DateUtils.timeStampToDate(taskExecutionContext.getFirstSubmitTime()),
- TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()));
- if (remainTime > 0) {
- log.info("Current taskInstance: {} is choosing delay execution, delay time: {}/ms, remainTime: {}/ms",
- taskExecutionContext.getTaskName(),
- TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()), remainTime);
- taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.DELAY_EXECUTION);
- // todo: send delay execution message
- return LogicTaskDispatchResponse.success(taskExecutionContext.getTaskInstanceId());
- }
+ int delayTime = taskExecutionContext.getDelayTime();
+ if (delayTime > 0) {
+ // todo: calculate the delay in master dispatcher then we don't need to use a queue to store the task
+ final long remainTime =
+ DateUtils.getRemainTime(DateUtils.timeStampToDate(taskExecutionContext.getFirstSubmitTime()),
+ TimeUnit.SECONDS.toMillis(delayTime));
+ if (remainTime > 0) {
+ log.info(
+ "Current taskInstance: {} is choosing delay execution, delay time: {}/ms, remainTime: {}/ms",
+ taskExecutionContext.getTaskName(),
+ TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()), remainTime);
+ taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.DELAY_EXECUTION);
+ // todo: send delay execution message
+ return LogicTaskDispatchResponse.success(taskExecutionContext.getTaskInstanceId());
+ }
+ }
Review Comment:
You also need to add this logic in GlobalTaskInstanceDispatchQueueLooper
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org