status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskProcessor.acton(TaskActon.TIMEOUT);
}
f (TaskTmeoutStrategy.WARN == taskTmeoutStrategy || TaskTmeoutStrategy.WARNFAILED == taskTmeoutStrategy) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, projectUser);
}
return true;
}
prvate boolean processTmeout() {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, projectUser);
return true;
}
prvate boolean taskStateChangeHandler(StateEvent stateEvent) {
f (!checkTaskInstanceByStateEvent(stateEvent)) {
return true;
}
TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId());
f (task.getState() == null) {
logger.error("task state s null, state handler error: {}", stateEvent);
return true;
}
f (task.getState().typeIsFnshed()) {
f (completeTaskMap.contansKey(task.getTaskCode()) && completeTaskMap.get(task.getTaskCode()) == task.getId()) {
return true;
}
taskFnshed(task);
f (task.getTaskGroupId() > 0) {
releaseTaskGroup(task);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return true;
}
f (actveTaskProcessorMaps.contansKey(task.getTaskCode())) {
ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(task.getTaskCode());
TaskProcessor.acton(TaskActon.RUN);
f (TaskProcessor.taskInstance().getState().typeIsFnshed()) {
f (TaskProcessor.taskInstance().getState() != task.getState()) {
task.setState(TaskProcessor.taskInstance().getState());
}
taskFnshed(task);
}
return true;
}
logger.error("state handler error: {}", stateEvent);
return true;
}
prvate vod taskFnshed(TaskInstance taskInstance) {
logger.nfo("work flow {} task d:{} code:{} state:{} ",
processInstance.getId(),
taskInstance.getId(),
taskInstance.getTaskCode(),
taskInstance.getState());
actveTaskProcessorMaps.remove(taskInstance.getTaskCode());
stateWheelExecuteThread.removeTask4TmeoutCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4RetryCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4StateCheck(processInstance, taskInstance);
f (taskInstance.getState().typeIsSuccess()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
processInstance.setVarPool(taskInstance.getVarPool());
processServce.saveProcessInstance(processInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (!processInstance.sBlocked()) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
}
} else f (taskInstance.taskCanRetry() && processInstance.getState() != ExecutonStatus.READY_STOP) {
retryTaskInstance(taskInstance);
} else f (taskInstance.getState().typeIsFalure()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (DagHelper.haveAllNodeAfterNode(Long.toStrng(taskInstance.getTaskCode()), dag)
&& processInstance.getFalureStrategy() == FalureStrategy.CONTINUE) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
} else {
errorTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
kllAllTasks();
}
}
} else f (taskInstance.getState().typeIsFnshed()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
}
ths.updateProcessInstanceState();
}
/**
* release task group
*
* @param taskInstance
*/
prvate vod releaseTaskGroup(TaskInstance taskInstance) {
f (taskInstance.getTaskGroupId() > 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(taskInstance);
f (nextTaskInstance != null) {
f (nextTaskInstance.getProcessInstanceId() == taskInstance.getProcessInstanceId()) {
StateEvent nextEvent = new StateEvent();
nextEvent.setProcessInstanceId(ths.processInstance.getId());
nextEvent.setTaskInstanceId(nextTaskInstance.getId());
nextEvent.setType(StateEventType.WAIT_TASK_GROUP);
ths.stateEvents.add(nextEvent);
} else {
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(nextTaskInstance.getProcessInstanceId());
ths.processServce.sendStartTask2Master(processInstance, nextTaskInstance.getId(),
org.apache.dolphnscheduler.remote.command.CommandType.TASK_WAKEUP_EVENT_REQUEST);
}
}
}
}
/**
* crate new task nstance to retry, dfferent objects from the orgnal
*
* @param taskInstance
*/
prvate vod retryTaskInstance(TaskInstance taskInstance) {
f (!taskInstance.taskCanRetry()) {
return;
}
TaskInstance newTaskInstance = cloneRetryTaskInstance(taskInstance);
f (newTaskInstance == null) {
logger.error("retry fal, new taskInstancce s null, task code:{}, task d:{}", taskInstance.getTaskCode(), taskInstance.getId());
return;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | watToRetryTaskInstanceMap.put(newTaskInstance.getTaskCode(), newTaskInstance);
f (!taskInstance.retryTaskIntervalOverTme()) {
logger.nfo("falure task wll be submtted: process d: {}, task nstance code: {} state:{} retry tmes:{} / {}, nterval:{}",
processInstance.getId(),
newTaskInstance.getTaskCode(),
newTaskInstance.getState(),
newTaskInstance.getRetryTmes(),
newTaskInstance.getMaxRetryTmes(),
newTaskInstance.getRetryInterval());
stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, newTaskInstance);
stateWheelExecuteThread.addTask4RetryCheck(processInstance, newTaskInstance);
} else {
addTaskToStandByLst(newTaskInstance);
submtStandByTask();
watToRetryTaskInstanceMap.remove(newTaskInstance.getTaskCode());
}
}
/**
* handle task retry event
*
* @param stateEvent
* @return
*/
prvate boolean taskRetryEventHandler(StateEvent stateEvent) {
TaskInstance taskInstance = watToRetryTaskInstanceMap.get(stateEvent.getTaskCode());
addTaskToStandByLst(taskInstance);
submtStandByTask();
watToRetryTaskInstanceMap.remove(stateEvent.getTaskCode());
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* update process nstance
*/
publc vod refreshProcessInstance(nt processInstanceId) {
logger.nfo("process nstance update: {}", processInstanceId);
processInstance = processServce.fndProcessInstanceById(processInstanceId);
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(),
processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
}
/**
* update task nstance
*/
publc vod refreshTaskInstance(nt taskInstanceId) {
logger.nfo("task nstance update: {} ", taskInstanceId);
TaskInstance taskInstance = processServce.fndTaskInstanceById(taskInstanceId);
f (taskInstance == null) {
logger.error("can not fnd task nstance, d:{}", taskInstanceId);
return;
}
processServce.packageTaskInstance(taskInstance, processInstance);
taskInstanceMap.put(taskInstance.getId(), taskInstance);
valdTaskMap.remove(taskInstance.getTaskCode());
f (Flag.YES == taskInstance.getFlag()) {
valdTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
}
}
/**
* check process nstance by state event
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | publc boolean checkProcessInstance(StateEvent stateEvent) {
f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.error("msmatch process nstance d: {}, state event:{}",
ths.processInstance.getId(),
stateEvent);
return false;
}
return true;
}
/**
* check f task nstance exst by state event
*/
publc boolean checkTaskInstanceByStateEvent(StateEvent stateEvent) {
f (stateEvent.getTaskInstanceId() == 0) {
logger.error("task nstance d null, state event:{}", stateEvent);
return false;
}
f (!taskInstanceMap.contansKey(stateEvent.getTaskInstanceId())) {
logger.error("msmatch task nstance d, event:{}", stateEvent);
return false;
}
return true;
}
/**
* check f task nstance exst by task code
*/
publc boolean checkTaskInstanceByCode(long taskCode) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return false;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | for (TaskInstance taskInstance : taskInstanceMap.values()) {
f (taskInstance.getTaskCode() == taskCode) {
return true;
}
}
return false;
}
/**
* check f task nstance exst by d
*/
publc boolean checkTaskInstanceById(nt taskInstanceId) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return false;
}
return taskInstanceMap.contansKey(taskInstanceId);
}
/**
* get task nstance from memory
*/
publc TaskInstance getTaskInstance(nt taskInstanceId) {
f (taskInstanceMap.contansKey(taskInstanceId)) {
return taskInstanceMap.get(taskInstanceId);
}
return null;
}
publc TaskInstance getTaskInstance(long taskCode) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return null;
}
for (TaskInstance taskInstance : taskInstanceMap.values()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (taskInstance.getTaskCode() == taskCode) {
return taskInstance;
}
}
return null;
}
publc TaskInstance getActveTaskInstanceByTaskCode(long taskCode) {
f (actveTaskProcessorMaps.contansKey(taskCode)) {
return actveTaskProcessorMaps.get(taskCode).taskInstance();
}
return null;
}
publc TaskInstance getRetryTaskInstanceByTaskCode(long taskCode) {
f (watToRetryTaskInstanceMap.contansKey(taskCode)) {
return watToRetryTaskInstanceMap.get(taskCode);
}
return null;
}
prvate boolean processStateChangeHandler(StateEvent stateEvent) {
try {
logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus());
f (stateEvent.getExecutonStatus() == ExecutonStatus.STOP) {
ths.updateProcessInstanceState(stateEvent);
return true;
}
f (processComplementData()) {
return true;
}
f (stateEvent.getExecutonStatus().typeIsFnshed()) {
endProcess(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
f (processInstance.getState() == ExecutonStatus.READY_STOP) {
kllAllTasks();
}
return true;
} catch (Excepton e) {
logger.error("process state change error:", e);
}
return true;
}
prvate boolean processBlockHandler(StateEvent stateEvent) {
try {
TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId());
f (!checkTaskInstanceByStateEvent(stateEvent)) {
logger.error("task {} s not a blockng task", task.getTaskCode());
return false;
}
BlockngParameters parameters = JSONUtls.parseObject(task.getTaskParams(), BlockngParameters.class);
f (parameters.sAlertWhenBlockng()) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendProcessBlockngAlert(processInstance, projectUser);
logger.nfo("processInstance {} block alert send successful!", processInstance.getId());
}
} catch (Excepton e) {
logger.error("sendng blockng message error:", e);
}
return true;
}
prvate boolean processComplementData() throws Excepton {
f (!needComplementProcess()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return false;
}
f (processInstance.getState() == ExecutonStatus.READY_STOP) {
return false;
}
Date scheduleDate = processInstance.getScheduleTme();
f (scheduleDate == null) {
scheduleDate = complementLstDate.get(0);
} else f (processInstance.getState().typeIsFnshed()) {
endProcess();
f (complementLstDate.sze() <= 0) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
nt ndex = complementLstDate.ndexOf(scheduleDate);
f (ndex >= complementLstDate.sze() - 1 || !processInstance.getState().typeIsSuccess()) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
logger.nfo("process complement contnue. process d:{}, schedule tme:{} complementLstDate:{}",
processInstance.getId(),
processInstance.getScheduleTme(),
complementLstDate.toStrng());
scheduleDate = complementLstDate.get(ndex + 1);
}
nt create = ths.createComplementDataCommand(scheduleDate);
f (create > 0) {
logger.nfo("create complement data command successfully."); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return true;
}
prvate nt createComplementDataCommand(Date scheduleDate) {
Command command = new Command();
command.setScheduleTme(scheduleDate);
command.setCommandType(CommandType.COMPLEMENT_DATA);
command.setProcessDefntonCode(processInstance.getProcessDefntonCode());
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam.contansKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) {
cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING);
}
cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtls.format(scheduleDate, "yyyy-MM-dd HH:mm:ss", null));
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
command.setTaskDependType(processInstance.getTaskDependType());
command.setFalureStrategy(processInstance.getFalureStrategy());
command.setWarnngType(processInstance.getWarnngType());
command.setWarnngGroupId(processInstance.getWarnngGroupId());
command.setStartTme(new Date());
command.setExecutorId(processInstance.getExecutorId());
command.setUpdateTme(new Date());
command.setProcessInstanceProrty(processInstance.getProcessInstanceProrty());
command.setWorkerGroup(processInstance.getWorkerGroup());
command.setEnvronmentCode(processInstance.getEnvronmentCode());
command.setDryRun(processInstance.getDryRun());
command.setProcessInstanceId(0);
command.setProcessDefntonVerson(processInstance.getProcessDefntonVerson());
return processServce.createCommand(command);
}
prvate boolean needComplementProcess() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (processInstance.sComplementData()
&& Flag.NO == processInstance.getIsSubProcess()) {
return true;
}
return false;
}
/**
* process start handle
*/
publc vod startProcess() {
f (ths.taskInstanceMap.sze() > 0) {
return;
}
try {
sStart = false;
buldFlowDag();
ntTaskQueue();
submtPostNode(null);
sStart = true;
} catch (Excepton e) {
logger.error("start process error, process nstance d:{}", processInstance.getId(), e);
}
}
/**
* process end handle
*/
prvate vod endProcess() {
ths.stateEvents.clear();
f (processDefnton.getExecutonType().typeIsSeralWat()) {
checkSeralProcess(processDefnton); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
f (processInstance.getState().typeIsWatngThread()) {
processServce.createRecoveryWatngThreadCommand(null, processInstance);
}
f (processAlertManager.sNeedToSendWarnng(processInstance)) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendAlertProcessInstance(processInstance, getValdTaskLst(), projectUser);
}
f (checkTaskQueue()) {
processServce.releaseAllTaskGroup(processInstance.getId());
}
}
publc vod checkSeralProcess(ProcessDefnton processDefnton) {
nt nextInstanceId = processInstance.getNextProcessInstanceId();
f (nextInstanceId == 0) {
ProcessInstance nextProcessInstance = ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.SERIAL_WAIT.getCode(), processInstance.getId());
f (nextProcessInstance == null) {
return;
}
nextInstanceId = nextProcessInstance.getId();
}
ProcessInstance nextProcessInstance = ths.processServce.fndProcessInstanceById(nextInstanceId);
f (nextProcessInstance.getState().typeIsFnshed() || nextProcessInstance.getState().typeIsRunnng()) {
return;
}
Map<Strng, Object> cmdParam = new HashMap<>();
cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, nextInstanceId);
Command command = new Command();
command.setCommandType(CommandType.RECOVER_SERIAL_WAIT); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | command.setProcessDefntonCode(processDefnton.getCode());
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
processServce.createCommand(command);
}
/**
* generate process dag
*
* @throws Excepton excepton
*/
prvate vod buldFlowDag() throws Excepton {
f (ths.dag != null) {
return;
}
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(),
processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
Lst<TaskInstance> recoverNodeLst = getStartTaskInstanceLst(processInstance.getCommandParam());
Lst<ProcessTaskRelaton> processTaskRelatons = processServce.fndRelatonByCode(processDefnton.getCode(), processDefnton.getVerson());
Lst<TaskDefntonLog> taskDefntonLogs = processServce.getTaskDefneLogLstByRelaton(processTaskRelatons);
Lst<TaskNode> taskNodeLst = processServce.transformTask(processTaskRelatons, taskDefntonLogs);
forbddenTaskMap.clear();
taskNodeLst.forEach(taskNode -> {
f (taskNode.sForbdden()) {
forbddenTaskMap.put(taskNode.getCode(), taskNode);
}
});
Lst<Strng> recoveryNodeCodeLst = getRecoveryNodeCodeLst(recoverNodeLst);
Lst<Strng> startNodeNameLst = parseStartNodeName(processInstance.getCommandParam());
ProcessDag processDag = generateFlowDag(taskNodeLst, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | startNodeNameLst, recoveryNodeCodeLst, processInstance.getTaskDependType());
f (processDag == null) {
logger.error("processDag s null");
return;
}
dag = DagHelper.buldDagGraph(processDag);
}
/**
* nt task queue
*/
prvate vod ntTaskQueue() {
taskFaledSubmt = false;
actveTaskProcessorMaps.clear();
dependFaledTaskMap.clear();
completeTaskMap.clear();
errorTaskMap.clear();
f (!sNewProcessInstance()) {
Lst<TaskInstance> valdTaskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId());
for (TaskInstance task : valdTaskInstanceLst) {
f (valdTaskMap.contansKey(task.getTaskCode())) {
nt oldTaskInstanceId = valdTaskMap.get(task.getTaskCode());
TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId);
f (!oldTaskInstance.getState().typeIsFnshed() && task.getState().typeIsFnshed()) {
task.setFlag(Flag.NO);
processServce.updateTaskInstance(task);
contnue;
}
logger.warn("have same taskCode taskInstance when nt task queue, taskCode:{}", task.getTaskCode());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | valdTaskMap.put(task.getTaskCode(), task.getId());
taskInstanceMap.put(task.getId(), task);
f (task.sTaskComplete()) {
completeTaskMap.put(task.getTaskCode(), task.getId());
contnue;
}
f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) {
contnue;
}
f (task.taskCanRetry()) {
f (task.getState() == ExecutonStatus.NEED_FAULT_TOLERANCE) {
TaskInstance tolerantTaskInstance = cloneTolerantTaskInstance(task);
addTaskToStandByLst(tolerantTaskInstance);
} else {
retryTaskInstance(task);
}
contnue;
}
f (task.getState().typeIsFalure()) {
errorTaskMap.put(task.getTaskCode(), task.getId());
}
}
}
f (processInstance.sComplementData() && complementLstDate.sze() == 0) {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam != null && cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) {
Date start = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));
Date end = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (complementLstDate.sze() == 0 && needComplementProcess()) {
complementLstDate = CronUtls.getSelfFreDateLst(start, end, schedules);
logger.nfo(" process defnton code:{} complement data: {}",
processInstance.getProcessDefntonCode(), complementLstDate.toStrng());
f (complementLstDate.sze() > 0 && Flag.NO == processInstance.getIsSubProcess()) {
processInstance.setScheduleTme(complementLstDate.get(0));
processInstance.setGlobalParams(ParameterUtls.curngGlobalParams(
processDefnton.getGlobalParamMap(),
processDefnton.getGlobalParamLst(),
CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme(), cmdParam.get(Constants.SCHEDULE_TIMEZONE)));
processServce.updateProcessInstance(processInstance);
}
}
}
}
}
/**
* submt task to execute
*
* @param taskInstance task nstance
* @return TaskInstance
*/
prvate TaskInstance submtTaskExec(TaskInstance taskInstance) {
try {
processServce.packageTaskInstance(taskInstance, processInstance);
ITaskProcessor taskProcessor = TaskProcessorFactory.getTaskProcessor(taskInstance.getTaskType());
taskProcessor.nt(taskInstance, processInstance);
f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION
&& taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | notfyProcessHostUpdate(taskInstance);
}
boolean submt = taskProcessor.acton(TaskActon.SUBMIT);
f (!submt) {
logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!",
processInstance.getId(), processInstance.getName(),
taskInstance.getId(), taskInstance.getName());
return null;
}
f (valdTaskMap.contansKey(taskInstance.getTaskCode())) {
nt oldTaskInstanceId = valdTaskMap.get(taskInstance.getTaskCode());
f (taskInstance.getId() != oldTaskInstanceId) {
TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId);
oldTaskInstance.setFlag(Flag.NO);
processServce.updateTaskInstance(oldTaskInstance);
valdTaskMap.remove(taskInstance.getTaskCode());
actveTaskProcessorMaps.remove(taskInstance.getTaskCode());
}
}
valdTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
taskInstanceMap.put(taskInstance.getId(), taskInstance);
actveTaskProcessorMaps.put(taskInstance.getTaskCode(), taskProcessor);
taskProcessor.acton(TaskActon.RUN);
stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, taskInstance);
stateWheelExecuteThread.addTask4StateCheck(processInstance, taskInstance);
f (taskProcessor.taskInstance().getState().typeIsFnshed()) {
f (processInstance.sBlocked()) {
StateEvent processBlockEvent = new StateEvent();
processBlockEvent.setProcessInstanceId(ths.processInstance.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | processBlockEvent.setTaskInstanceId(taskInstance.getId());
processBlockEvent.setExecutonStatus(taskProcessor.taskInstance().getState());
processBlockEvent.setType(StateEventType.PROCESS_BLOCKED);
ths.stateEvents.add(processBlockEvent);
}
StateEvent taskStateChangeEvent = new StateEvent();
taskStateChangeEvent.setProcessInstanceId(ths.processInstance.getId());
taskStateChangeEvent.setTaskInstanceId(taskInstance.getId());
taskStateChangeEvent.setExecutonStatus(taskProcessor.taskInstance().getState());
taskStateChangeEvent.setType(StateEventType.TASK_STATE_CHANGE);
ths.stateEvents.add(taskStateChangeEvent);
}
return taskInstance;
} catch (Excepton e) {
logger.error("submt standby task error", e);
return null;
}
}
prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) {
f (StrngUtls.sEmpty(taskInstance.getHost())) {
return;
}
try {
HostUpdateCommand hostUpdateCommand = new HostUpdateCommand();
hostUpdateCommand.setProcessHost(NetUtls.getAddr(masterConfg.getLstenPort()));
hostUpdateCommand.setTaskInstanceId(taskInstance.getId());
Host host = new Host(taskInstance.getHost());
nettyExecutorManager.doExecute(host, hostUpdateCommand.convert2Command());
} catch (Excepton e) {
logger.error("notfy process host update", e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
}
/**
* fnd task nstance n db.
* n case submt more than one same name task n the same tme.
*
* @param taskCode task code
* @param taskVerson task verson
* @return TaskInstance
*/
prvate TaskInstance fndTaskIfExsts(Long taskCode, nt taskVerson) {
Lst<TaskInstance> valdTaskInstanceLst = getValdTaskLst();
for (TaskInstance taskInstance : valdTaskInstanceLst) {
f (taskInstance.getTaskCode() == taskCode && taskInstance.getTaskDefntonVerson() == taskVerson) {
return taskInstance;
}
}
return null;
}
/**
* encapsulaton task
*
* @param processInstance process nstance
* @param taskNode taskNode
* @return TaskInstance
*/
prvate TaskInstance createTaskInstance(ProcessInstance processInstance, TaskNode taskNode) {
TaskInstance taskInstance = fndTaskIfExsts(taskNode.getCode(), taskNode.getVerson());
f (taskInstance != null) {
return taskInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return newTaskInstance(processInstance, taskNode);
}
/**
* clone a new taskInstance for retry and reset some logc felds
*
* @return
*/
publc TaskInstance cloneRetryTaskInstance(TaskInstance taskInstance) {
TaskNode taskNode = dag.getNode(Long.toStrng(taskInstance.getTaskCode()));
f (taskNode == null) {
logger.error("taskNode s null, code:{}", taskInstance.getTaskCode());
return null;
}
TaskInstance newTaskInstance = newTaskInstance(processInstance, taskNode);
newTaskInstance.setTaskDefne(taskInstance.getTaskDefne());
newTaskInstance.setProcessDefne(taskInstance.getProcessDefne());
newTaskInstance.setProcessInstance(processInstance);
newTaskInstance.setRetryTmes(taskInstance.getRetryTmes() + 1);
newTaskInstance.setState(taskInstance.getState());
newTaskInstance.setEndTme(taskInstance.getEndTme());
return newTaskInstance;
}
/**
* clone a new taskInstance for tolerant and reset some logc felds
*
* @return
*/
publc TaskInstance cloneTolerantTaskInstance(TaskInstance taskInstance) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | TaskNode taskNode = dag.getNode(Long.toStrng(taskInstance.getTaskCode()));
f (taskNode == null) {
logger.error("taskNode s null, code:{}", taskInstance.getTaskCode());
return null;
}
TaskInstance newTaskInstance = newTaskInstance(processInstance, taskNode);
newTaskInstance.setTaskDefne(taskInstance.getTaskDefne());
newTaskInstance.setProcessDefne(taskInstance.getProcessDefne());
newTaskInstance.setProcessInstance(processInstance);
newTaskInstance.setRetryTmes(taskInstance.getRetryTmes());
newTaskInstance.setState(taskInstance.getState());
return newTaskInstance;
}
/**
* new a taskInstance
*
* @param processInstance
* @param taskNode
* @return
*/
publc TaskInstance newTaskInstance(ProcessInstance processInstance, TaskNode taskNode) {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setTaskCode(taskNode.getCode());
taskInstance.setTaskDefntonVerson(taskNode.getVerson());
taskInstance.setName(taskNode.getName());
taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS);
taskInstance.setProcessInstanceId(processInstance.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskInstance.setTaskType(taskNode.getType().toUpperCase());
taskInstance.setAlertFlag(Flag.NO);
taskInstance.setStartTme(null);
taskInstance.setFlag(Flag.YES);
taskInstance.setDryRun(processInstance.getDryRun());
taskInstance.setRetryTmes(0);
taskInstance.setMaxRetryTmes(taskNode.getMaxRetryTmes());
taskInstance.setRetryInterval(taskNode.getRetryInterval());
taskInstance.setTaskParams(taskNode.getTaskParams());
taskInstance.setTaskGroupId(taskNode.getTaskGroupId());
taskInstance.setTaskGroupProrty(taskNode.getTaskGroupProrty());
f (taskNode.getTaskInstanceProrty() == null) {
taskInstance.setTaskInstanceProrty(Prorty.MEDIUM);
} else {
taskInstance.setTaskInstanceProrty(taskNode.getTaskInstanceProrty());
}
Strng processWorkerGroup = processInstance.getWorkerGroup();
processWorkerGroup = StrngUtls.sBlank(processWorkerGroup) ? DEFAULT_WORKER_GROUP : processWorkerGroup;
Strng taskWorkerGroup = StrngUtls.sBlank(taskNode.getWorkerGroup()) ? processWorkerGroup : taskNode.getWorkerGroup(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | Long processEnvronmentCode = Objects.sNull(processInstance.getEnvronmentCode()) ? -1 : processInstance.getEnvronmentCode();
Long taskEnvronmentCode = Objects.sNull(taskNode.getEnvronmentCode()) ? processEnvronmentCode : taskNode.getEnvronmentCode();
f (!processWorkerGroup.equals(DEFAULT_WORKER_GROUP) && taskWorkerGroup.equals(DEFAULT_WORKER_GROUP)) {
taskInstance.setWorkerGroup(processWorkerGroup);
taskInstance.setEnvronmentCode(processEnvronmentCode);
} else {
taskInstance.setWorkerGroup(taskWorkerGroup);
taskInstance.setEnvronmentCode(taskEnvronmentCode);
}
f (!taskInstance.getEnvronmentCode().equals(-1L)) {
Envronment envronment = processServce.fndEnvronmentByCode(taskInstance.getEnvronmentCode());
f (Objects.nonNull(envronment) && StrngUtls.sNotEmpty(envronment.getConfg())) {
taskInstance.setEnvronmentConfg(envronment.getConfg());
}
}
taskInstance.setDelayTme(taskNode.getDelayTme());
return taskInstance;
}
publc vod getPreVarPool(TaskInstance taskInstance, Set<Strng> preTask) {
Map<Strng, Property> allProperty = new HashMap<>();
Map<Strng, TaskInstance> allTaskInstance = new HashMap<>();
f (CollectonUtls.sNotEmpty(preTask)) {
for (Strng preTaskCode : preTask) {
Integer taskId = completeTaskMap.get(Long.parseLong(preTaskCode));
f (taskId == null) {
contnue;
}
TaskInstance preTaskInstance = taskInstanceMap.get(taskId);
f (preTaskInstance == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | contnue;
}
Strng preVarPool = preTaskInstance.getVarPool();
f (StrngUtls.sNotEmpty(preVarPool)) {
Lst<Property> propertes = JSONUtls.toLst(preVarPool, Property.class);
for (Property nfo : propertes) {
setVarPoolValue(allProperty, allTaskInstance, preTaskInstance, nfo);
}
}
}
f (allProperty.sze() > 0) {
taskInstance.setVarPool(JSONUtls.toJsonStrng(allProperty.values()));
}
} else {
f (StrngUtls.sNotEmpty(processInstance.getVarPool())) {
taskInstance.setVarPool(processInstance.getVarPool());
}
}
}
prvate vod setVarPoolValue(Map<Strng, Property> allProperty, Map<Strng, TaskInstance> allTaskInstance, TaskInstance preTaskInstance, Property thsProperty) {
thsProperty.setDrect(Drect.IN);
Strng proName = thsProperty.getProp();
f (allProperty.contansKey(proName)) {
Property otherPro = allProperty.get(proName);
f (StrngUtls.sEmpty(thsProperty.getValue())) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | allProperty.put(proName, otherPro);
} else f (StrngUtls.sNotEmpty(otherPro.getValue())) {
TaskInstance otherTask = allTaskInstance.get(proName);
f (otherTask.getEndTme().getTme() > preTaskInstance.getEndTme().getTme()) {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
} else {
allProperty.put(proName, otherPro);
}
} else {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
}
} else {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
}
}
/**
* get complete task nstance map, taskCode as key
*/
prvate Map<Strng, TaskInstance> getCompleteTaskInstanceMap() {
Map<Strng, TaskInstance> completeTaskInstanceMap = new HashMap<>();
for (Integer taskInstanceId : completeTaskMap.values()) {
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
completeTaskInstanceMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance);
}
return completeTaskInstanceMap;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* get vald task lst
*/
prvate Lst<TaskInstance> getValdTaskLst() {
Lst<TaskInstance> valdTaskInstanceLst = new ArrayLst<>();
for (Integer taskInstanceId : valdTaskMap.values()) {
valdTaskInstanceLst.add(taskInstanceMap.get(taskInstanceId));
}
return valdTaskInstanceLst;
}
prvate vod submtPostNode(Strng parentNodeCode) {
Set<Strng> submtTaskNodeLst = DagHelper.parsePostNodes(parentNodeCode, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
Lst<TaskInstance> taskInstances = new ArrayLst<>();
for (Strng taskNode : submtTaskNodeLst) {
TaskNode taskNodeObject = dag.getNode(taskNode);
TaskInstance exstTaskInstance = getTaskInstance(taskNodeObject.getCode());
f (exstTaskInstance != null) {
taskInstances.add(exstTaskInstance);
contnue;
}
TaskInstance task = createTaskInstance(processInstance, taskNodeObject);
taskInstances.add(task);
}
f (StrngUtls.sNotEmpty(parentNodeCode) && dag.getEndNode().contans(parentNodeCode)) {
TaskInstance endTaskInstance = taskInstanceMap.get(completeTaskMap.get(NumberUtls.toLong(parentNodeCode)));
Strng taskInstanceVarPool = endTaskInstance.getVarPool();
f (StrngUtls.sNotEmpty(taskInstanceVarPool)) {
Set<Property> taskPropertes = JSONUtls.toLst(taskInstanceVarPool, Property.class)
.stream().collect(Collectors.toSet()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | Strng processInstanceVarPool = processInstance.getVarPool();
f (StrngUtls.sNotEmpty(processInstanceVarPool)) {
Set<Property> propertes = JSONUtls.toLst(processInstanceVarPool, Property.class)
.stream().collect(Collectors.toSet());
propertes.addAll(taskPropertes);
processInstance.setVarPool(JSONUtls.toJsonStrng(propertes));
} else {
processInstance.setVarPool(JSONUtls.toJsonStrng(taskPropertes));
}
}
}
for (TaskInstance task : taskInstances) {
f (readyToSubmtTaskQueue.contans(task)) {
contnue;
}
f (task.getId() > 0 && completeTaskMap.contansKey(task.getTaskCode())) {
logger.nfo("task {} has already run success", task.getName());
contnue;
}
f (task.getState().typeIsPause() || task.getState().typeIsCancel()) {
logger.nfo("task {} stopped, the state s {}", task.getName(), task.getState());
contnue;
}
addTaskToStandByLst(task);
}
submtStandByTask();
updateProcessInstanceState();
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * determne whether the dependences of the task node are complete
*
* @return DependResult
*/
prvate DependResult sTaskDepsComplete(Strng taskCode) {
Collecton<Strng> startNodes = dag.getBegnNode();
f (startNodes.contans(taskCode)) {
return DependResult.SUCCESS;
}
TaskNode taskNode = dag.getNode(taskCode);
Lst<Strng> ndrectDepCodeLst = new ArrayLst<>();
setIndrectDepLst(taskCode, ndrectDepCodeLst);
for (Strng depsNode : ndrectDepCodeLst) {
f (dag.contansNode(depsNode) && !skpTaskNodeMap.contansKey(depsNode)) {
Long despNodeTaskCode = Long.parseLong(depsNode);
f (!completeTaskMap.contansKey(despNodeTaskCode)) {
return DependResult.WAITING;
}
Integer depsTaskId = completeTaskMap.get(despNodeTaskCode);
ExecutonStatus depTaskState = taskInstanceMap.get(depsTaskId).getState();
f (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) {
return DependResult.NON_EXEC;
}
f (taskNode.sCondtonsTask() || taskNode.sBlockngTask()) {
contnue;
}
f (!dependTaskSuccess(depsNode, taskCode)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return DependResult.FAILED;
}
}
}
logger.nfo("taskCode: {} completeDependTaskLst: {}", taskCode, Arrays.toStrng(completeTaskMap.keySet().toArray()));
return DependResult.SUCCESS;
}
/**
* Ths functon s specally used to handle the dependency stuaton where the parent node s a prohbted node.
* When the parent node s a forbdden node, the dependency relatonshp should contnue to be traced
*
* @param taskCode taskCode
* @param ndrectDepCodeLst All ndrectly dependent nodes
*/
prvate vod setIndrectDepLst(Strng taskCode, Lst<Strng> ndrectDepCodeLst) {
TaskNode taskNode = dag.getNode(taskCode);
Lst<Strng> depCodeLst = taskNode.getDepLst();
for (Strng depsNode : depCodeLst) {
f (forbddenTaskMap.contansKey(Long.parseLong(depsNode))) {
setIndrectDepLst(depsNode, ndrectDepCodeLst);
} else {
ndrectDepCodeLst.add(depsNode);
}
}
}
/**
* depend node s completed, but here need check the condton task branch s the next node
*/
prvate boolean dependTaskSuccess(Strng dependNodeName, Strng nextNodeName) {
f (dag.getNode(dependNodeName).sCondtonsTask()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | Lst<Strng> nextTaskLst = DagHelper.parseCondtonTask(dependNodeName, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
f (!nextTaskLst.contans(nextNodeName)) {
return false;
}
} else {
long taskCode = Long.parseLong(dependNodeName);
Integer taskInstanceId = completeTaskMap.get(taskCode);
ExecutonStatus depTaskState = taskInstanceMap.get(taskInstanceId).getState();
f (depTaskState.typeIsFalure()) {
return false;
}
}
return true;
}
/**
* query task nstance by complete state
*
* @param state state
* @return task nstance lst
*/
prvate Lst<TaskInstance> getCompleteTaskByState(ExecutonStatus state) {
Lst<TaskInstance> resultLst = new ArrayLst<>();
for (Integer taskInstanceId : completeTaskMap.values()) {
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
f (taskInstance != null && taskInstance.getState() == state) {
resultLst.add(taskInstance);
}
}
return resultLst; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
/**
* where there are ongong tasks
*
* @param state state
* @return ExecutonStatus
*/
prvate ExecutonStatus runnngState(ExecutonStatus state) {
f (state == ExecutonStatus.READY_STOP
|| state == ExecutonStatus.READY_PAUSE
|| state == ExecutonStatus.WAITING_THREAD
|| state == ExecutonStatus.READY_BLOCK
|| state == ExecutonStatus.DELAY_EXECUTION) {
return state;
} else {
return ExecutonStatus.RUNNING_EXECUTION;
}
}
/**
* exsts falure task,contans submt falure、dependency falure,execute falure(retry after)
*
* @return Boolean whether has faled task
*/
prvate boolean hasFaledTask() {
f (ths.taskFaledSubmt) {
return true;
}
f (ths.errorTaskMap.sze() > 0) {
return true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return ths.dependFaledTaskMap.sze() > 0;
}
/**
* process nstance falure
*
* @return Boolean whether process nstance faled
*/
prvate boolean processFaled() {
f (hasFaledTask()) {
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
return true;
}
f (processInstance.getFalureStrategy() == FalureStrategy.CONTINUE) {
return readyToSubmtTaskQueue.sze() == 0
&& actveTaskProcessorMaps.sze() == 0
&& watToRetryTaskInstanceMap.sze() == 0;
}
}
return false;
}
/**
* whether task for watng thread
*
* @return Boolean whether has watng thread task
*/
prvate boolean hasWatngThreadTask() {
Lst<TaskInstance> watngLst = getCompleteTaskByState(ExecutonStatus.WAITING_THREAD);
return CollectonUtls.sNotEmpty(watngLst);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* prepare for pause
* 1,faled retry task n the preparaton queue , returns to falure drectly
* 2,exsts pause task,complement not completed, pendng submsson of tasks, return to suspenson
* 3,success
*
* @return ExecutonStatus
*/
prvate ExecutonStatus processReadyPause() {
f (hasRetryTaskInStandBy()) {
return ExecutonStatus.FAILURE;
}
Lst<TaskInstance> pauseLst = getCompleteTaskByState(ExecutonStatus.PAUSE);
f (CollectonUtls.sNotEmpty(pauseLst)
|| processInstance.sBlocked()
|| !sComplementEnd()
|| readyToSubmtTaskQueue.sze() > 0) {
return ExecutonStatus.PAUSE;
} else {
return ExecutonStatus.SUCCESS;
}
}
/**
* prepare for block
* f process has tasks stll runnng, pause them
* f readyToSubmtTaskQueue s not empty, kll them
* else return block status drectly
*
* @return ExecutonStatus
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | prvate ExecutonStatus processReadyBlock() {
f (actveTaskProcessorMaps.sze() > 0) {
for (ITaskProcessor taskProcessor : actveTaskProcessorMaps.values()) {
f (!TASK_TYPE_BLOCKING.equals(taskProcessor.getType())) {
taskProcessor.acton(TaskActon.PAUSE);
}
}
}
f (readyToSubmtTaskQueue.sze() > 0) {
for (Iterator<TaskInstance> ter = readyToSubmtTaskQueue.terator(); ter.hasNext(); ) {
ter.next().setState(ExecutonStatus.KILL);
}
}
return ExecutonStatus.BLOCK;
}
/**
* generate the latest process nstance status by the tasks state
*
* @return process nstance executon status
*/
prvate ExecutonStatus getProcessInstanceState(ProcessInstance nstance) {
ExecutonStatus state = nstance.getState();
f (actveTaskProcessorMaps.sze() > 0 || hasRetryTaskInStandBy()) {
// actve
return runnngState(state);
}
// block
f (state == ExecutonStatus.READY_BLOCK) {
return processReadyBlock();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | // watng thread
f (hasWatngThreadTask()) {
return ExecutonStatus.WAITING_THREAD;
}
// pause
f (state == ExecutonStatus.READY_PAUSE) {
return processReadyPause();
}
// stop
f (state == ExecutonStatus.READY_STOP) {
Lst<TaskInstance> stopLst = getCompleteTaskByState(ExecutonStatus.STOP);
Lst<TaskInstance> kllLst = getCompleteTaskByState(ExecutonStatus.KILL);
Lst<TaskInstance> falLst = getCompleteTaskByState(ExecutonStatus.FAILURE);
f (CollectonUtls.sNotEmpty(stopLst)
|| CollectonUtls.sNotEmpty(kllLst)
|| CollectonUtls.sNotEmpty(falLst)
|| !sComplementEnd()) {
return ExecutonStatus.STOP;
} else {
return ExecutonStatus.SUCCESS;
}
}
// process falure
f (processFaled()) {
return ExecutonStatus.FAILURE;
}
// success
f (state == ExecutonStatus.RUNNING_EXECUTION) {
Lst<TaskInstance> kllTasks = getCompleteTaskByState(ExecutonStatus.KILL);
f (readyToSubmtTaskQueue.sze() > 0 || watToRetryTaskInstanceMap.sze() > 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | //tasks cu
return ExecutonStatus.RUNNING_EXECUTION;
} else f (CollectonUtls.sNotEmpty(kllTasks)) {
// tasks m
return ExecutonStatus.FAILURE;
} else {
// f the
return ExecutonStatus.SUCCESS;
}
}
return state;
}
/**
* whether complement end
*
* @return Boolean whether s complement end
*/
prvate boolean sComplementEnd() {
f (!processInstance.sComplementData()) {
return true;
}
try {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
Date endTme = DateUtls.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
return processInstance.getScheduleTme().equals(endTme);
} catch (Excepton e) {
logger.error("complement end faled ", e);
return false;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* updateProcessInstance process nstance state
* after each batch of tasks s executed, the status of the process nstance s updated
*/
prvate vod updateProcessInstanceState() {
ExecutonStatus state = getProcessInstanceState(processInstance);
f (processInstance.getState() != state) {
logger.nfo(
"work flow process nstance [d: {}, name:{}], state change from {} to {}, cmd type: {}",
processInstance.getId(), processInstance.getName(),
processInstance.getState(), state,
processInstance.getCommandType());
processInstance.setState(state);
f (state.typeIsFnshed()) {
processInstance.setEndTme(new Date());
}
processServce.updateProcessInstance(processInstance);
StateEvent stateEvent = new StateEvent();
stateEvent.setExecutonStatus(processInstance.getState());
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setType(StateEventType.PROCESS_STATE_CHANGE);
// ths.pr
// replace
ths.stateEvents.add(stateEvent);
}
}
/**
* stateEvent's executon status as process nstance state
*/
prvate vod updateProcessInstanceState(StateEvent stateEvent) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | ExecutonStatus state = stateEvent.getExecutonStatus();
f (processInstance.getState() != state) {
logger.nfo(
"work flow process nstance [d: {}, name:{}], state change from {} to {}, cmd type: {}",
processInstance.getId(), processInstance.getName(),
processInstance.getState(), state,
processInstance.getCommandType());
processInstance.setState(state);
f (state.typeIsFnshed()) {
processInstance.setEndTme(new Date());
}
processServce.updateProcessInstance(processInstance);
}
}
/**
* get task dependency result
*
* @param taskInstance task nstance
* @return DependResult
*/
prvate DependResult getDependResultForTask(TaskInstance taskInstance) {
return sTaskDepsComplete(Long.toStrng(taskInstance.getTaskCode()));
}
/**
* add task to standby lst
*
* @param taskInstance task nstance
*/
prvate vod addTaskToStandByLst(TaskInstance taskInstance) {
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (readyToSubmtTaskQueue.contans(taskInstance)) {
logger.warn("task was found n ready submt queue, task code:{}", taskInstance.getTaskCode());
return;
}
logger.nfo("add task to stand by lst, task name:{}, task d:{}, task code:{}",
taskInstance.getName(), taskInstance.getId(), taskInstance.getTaskCode());
readyToSubmtTaskQueue.put(taskInstance);
} catch (Excepton e) {
logger.error("add task nstance to readyToSubmtTaskQueue, taskName:{}, task d:{}", taskInstance.getName(), taskInstance.getId(), e);
}
}
/**
* remove task from stand by lst
*
* @param taskInstance task nstance
*/
prvate vod removeTaskFromStandbyLst(TaskInstance taskInstance) {
logger.nfo("remove task from stand by lst, d: {} name:{}",
taskInstance.getId(),
taskInstance.getName());
try {
readyToSubmtTaskQueue.remove(taskInstance);
} catch (Excepton e) {
logger.error("remove task nstance from readyToSubmtTaskQueue error, task d:{}, Name: {}",
taskInstance.getId(),
taskInstance.getName(), e);
}
}
/**
* has retry task n standby |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | *
* @return Boolean whether has retry task n standby
*/
prvate boolean hasRetryTaskInStandBy() {
for (Iterator<TaskInstance> ter = readyToSubmtTaskQueue.terator(); ter.hasNext(); ) {
f (ter.next().getState().typeIsFalure()) {
return true;
}
}
return false;
}
/**
* close the on gong tasks
*/
prvate vod kllAllTasks() {
logger.nfo("kll called on process nstance d: {}, num: {}", processInstance.getId(),
actveTaskProcessorMaps.sze());
f (readyToSubmtTaskQueue.sze() > 0) {
readyToSubmtTaskQueue.clear();
}
for (long taskCode : actveTaskProcessorMaps.keySet()) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskCode);
Integer taskInstanceId = valdTaskMap.get(taskCode);
f (taskInstanceId == null || taskInstanceId.equals(0)) {
contnue;
}
TaskInstance taskInstance = processServce.fndTaskInstanceById(taskInstanceId);
f (taskInstance == null || taskInstance.getState().typeIsFnshed()) {
contnue;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskProcessor.acton(TaskActon.STOP);
f (taskProcessor.taskInstance().getState().typeIsFnshed()) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setExecutonStatus(taskProcessor.taskInstance().getState());
ths.addStateEvent(stateEvent);
}
}
}
publc boolean workFlowFnsh() {
return ths.processInstance.getState().typeIsFnshed();
}
/**
* handlng the lst of tasks to be submtted
*/
prvate vod submtStandByTask() {
try {
nt length = readyToSubmtTaskQueue.sze();
for (nt = 0; < length; ++) {
TaskInstance task = readyToSubmtTaskQueue.peek();
f (task == null) {
contnue;
}
// stop ta
f (task.taskCanRetry()) {
TaskInstance retryTask = processServce.fndTaskInstanceById(task.getId());
f (retryTask != null && retryTask.getState().equals(ExecutonStatus.FORCED_SUCCESS)) {
task.setState(retryTask.getState()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | logger.nfo("task: {} has been forced success, put t nto complete task lst and stop retryng", task.getName());
removeTaskFromStandbyLst(task);
completeTaskMap.put(task.getTaskCode(), task.getId());
taskInstanceMap.put(task.getId(), task);
submtPostNode(Long.toStrng(task.getTaskCode()));
contnue;
}
}
//nt var
f (task.sFrstRun()) {
//get pre
Set<Strng> preTask = dag.getPrevousNodes(Long.toStrng(task.getTaskCode()));
getPreVarPool(task, preTask);
}
DependResult dependResult = getDependResultForTask(task);
f (DependResult.SUCCESS == dependResult) {
TaskInstance taskInstance = submtTaskExec(task);
f (taskInstance == null) {
ths.taskFaledSubmt = true;
// Remove
removeTaskFromStandbyLst(task);
completeTaskMap.put(task.getTaskCode(), task.getId());
errorTaskMap.put(task.getTaskCode(), task.getId());
logger.error("process {}, task {}, code:{} submt task faled.", task.getProcessInstanceId(), task.getName(), task.getTaskCode());
} else {
removeTaskFromStandbyLst(task);
}
} else f (DependResult.FAILED == dependResult) {
// f the
dependFaledTaskMap.put(task.getTaskCode(), task.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | removeTaskFromStandbyLst(task);
logger.nfo("task {},d:{} depend result : {}", task.getName(), task.getId(), dependResult);
} else f (DependResult.NON_EXEC == dependResult) {
// for som
removeTaskFromStandbyLst(task);
logger.nfo("remove task {},d:{} , because depend result : {}", task.getName(), task.getId(), dependResult);
}
}
} catch (Excepton e) {
logger.error("submt standby task error", e);
}
}
/**
* get recovery task nstance lst
*
* @param taskIdArray task d array
* @return recovery task nstance lst
*/
prvate Lst<TaskInstance> getRecoverTaskInstanceLst(Strng[] taskIdArray) {
f (taskIdArray == null || taskIdArray.length == 0) {
return new ArrayLst<>();
}
Lst<Integer> taskIdLst = new ArrayLst<>(taskIdArray.length);
for (Strng taskId : taskIdArray) {
try {
Integer d = Integer.valueOf(taskId);
taskIdLst.add(d);
} catch (Excepton e) {
logger.error("get recovery task nstance faled ", e);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return processServce.fndTaskInstanceByIdLst(taskIdLst);
}
/**
* get start task nstance lst
*
* @param cmdParam command param
* @return task nstance lst
*/
prvate Lst<TaskInstance> getStartTaskInstanceLst(Strng cmdParam) {
Lst<TaskInstance> nstanceLst = new ArrayLst<>();
Map<Strng, Strng> paramMap = JSONUtls.toMap(cmdParam);
f (paramMap != null && paramMap.contansKey(CMD_PARAM_RECOVERY_START_NODE_STRING)) {
Strng[] dLst = paramMap.get(CMD_PARAM_RECOVERY_START_NODE_STRING).splt(Constants.COMMA);
nstanceLst = getRecoverTaskInstanceLst(dLst);
}
return nstanceLst;
}
/**
* parse "StartNodeNameLst" from cmd param
*
* @param cmdParam command param
* @return start node name lst
*/
prvate Lst<Strng> parseStartNodeName(Strng cmdParam) {
Lst<Strng> startNodeNameLst = new ArrayLst<>();
Map<Strng, Strng> paramMap = JSONUtls.toMap(cmdParam);
f (paramMap == null) {
return startNodeNameLst;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (paramMap.contansKey(CMD_PARAM_START_NODES)) {
startNodeNameLst = Arrays.asLst(paramMap.get(CMD_PARAM_START_NODES).splt(Constants.COMMA));
}
return startNodeNameLst;
}
/**
* generate start node code lst from parsng command param;
* f "StartNodeIdLst" exsts n command param, return StartNodeIdLst
*
* @return recovery node code lst
*/
prvate Lst<Strng> getRecoveryNodeCodeLst(Lst<TaskInstance> recoverNodeLst) {
Lst<Strng> recoveryNodeCodeLst = new ArrayLst<>();
f (CollectonUtls.sNotEmpty(recoverNodeLst)) {
for (TaskInstance task : recoverNodeLst) {
recoveryNodeCodeLst.add(Long.toStrng(task.getTaskCode()));
}
}
return recoveryNodeCodeLst;
}
/**
* generate flow dag
*
* @param totalTaskNodeLst total task node lst
* @param startNodeNameLst start node name lst
* @param recoveryNodeCodeLst recovery node code lst
* @param depNodeType depend node type
* @return ProcessDag process dag
* @throws Excepton excepton
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,831 | [Bug-GroupQueue] Task queue status not updated after forcing. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Task queue status not updated after forcing.
### What you expected to happen
normal
### How to reproduce
Create task groups and execute workflows.
### Anything else
No Response
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9831 | https://github.com/apache/dolphinscheduler/pull/9832 | bbf6c4ed62e0b5ad57d41691a05032e2a613c739 | 3cea039239a4f4fbe8959228be6f38123f02285c | 2022-04-28T08:05:11Z | java | 2022-04-28T08:41:00Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | publc ProcessDag generateFlowDag(Lst<TaskNode> totalTaskNodeLst,
Lst<Strng> startNodeNameLst,
Lst<Strng> recoveryNodeCodeLst,
TaskDependType depNodeType) throws Excepton {
return DagHelper.generateFlowDag(totalTaskNodeLst, startNodeNameLst, recoveryNodeCodeLst, depNodeType);
}
/**
* check task queue
*/
prvate boolean checkTaskQueue() {
AtomcBoolean result = new AtomcBoolean(false);
taskInstanceMap.forEach((d, taskInstance) -> {
f (taskInstance != null && taskInstance.getTaskGroupId() > 0) {
result.set(true);
}
});
return result.get();
}
/**
* s new process nstance
*/
prvate boolean sNewProcessInstance() {
f (ExecutonStatus.RUNNING_EXECUTION == processInstance.getState() && processInstance.getRunTmes() == 1) {
return true;
} else {
return false;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_NODES;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_PARAMS;
import static org.apache.dolphinscheduler.common.Constants.MAX_TASK_TIMEOUT;
import org.apache.dolphinscheduler.api.enums.ExecuteType;
import org.apache.dolphinscheduler.api.enums.Status; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.MonitorService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.ComplementDependentMode;
import org.apache.dolphinscheduler.common.enums.CycleEnum;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.RunMode;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.TaskGroupQueueStatus;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.model.Server;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.remote.command.StateEventChangeCommand;
import org.apache.dolphinscheduler.remote.processor.StateEventCallbackService;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.quartz.cron.CronUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | import java.util.*;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.type.TypeReference;
/**
* executor service impl
*/
@Service
public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorService {
private static final Logger logger = LoggerFactory.getLogger(ExecutorServiceImpl.class);
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private MonitorService monitorService;
@Autowired
private ProcessInstanceMapper processInstanceMapper;
@Autowired
private ProcessService processService;
@Autowired
StateEventCallbackService stateEventCallbackService;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private TaskGroupQueueMapper taskGroupQueueMapper;
/**
* execute process instance
*
* @param loginUser login user
* @param projectCode project code
* @param processDefinitionCode process definition code
* @param cronTime cron time
* @param commandType command type
* @param failureStrategy failure strategy
* @param startNodeList start nodelist
* @param taskDependType node dependency type
* @param warningType warning type
* @param warningGroupId notify group id
* @param processInstancePriority process instance priority
* @param workerGroup worker group name
* @param environmentCode environment code
* @param runMode run mode
* @param timeout timeout
* @param startParams the global param values which pass to new process instance
* @param expectedParallelismNumber the expected parallelism number when execute complement in parallel mode
* @return execute process instance code
*/
@Override
public Map<String, Object> execProcessInstance(User loginUser, long projectCode,
long processDefinitionCode, String cronTime, CommandType commandType,
FailureStrategy failureStrategy, String startNodeList,
TaskDependType taskDependType, WarningType warningType, int warningGroupId, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | RunMode runMode,
Priority processInstancePriority, String workerGroup, Long environmentCode,Integer timeout,
Map<String, String> startParams, Integer expectedParallelismNumber,
int dryRun,
ComplementDependentMode complementDependentMode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (timeout <= 0 || timeout > MAX_TASK_TIMEOUT) {
putMsg(result, Status.TASK_TIMEOUT_PARAMS_ERROR);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
result = checkProcessDefinitionValid(projectCode, processDefinition, processDefinitionCode, processDefinition.getVersion());
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (!checkTenantSuitable(processDefinition)) {
logger.error("there is not any valid tenant for the process definition: id:{},name:{}, ",
processDefinition.getId(), processDefinition.getName());
putMsg(result, Status.TENANT_NOT_SUITABLE);
return result;
}
if (!checkMasterExists(result)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | return result;
}
/**
* create command
*/
int create = this.createCommand(commandType, processDefinition.getCode(),
taskDependType, failureStrategy, startNodeList, cronTime, warningType, loginUser.getId(),
warningGroupId, runMode, processInstancePriority, workerGroup, environmentCode, startParams,
expectedParallelismNumber, dryRun, complementDependentMode);
if (create > 0) {
processDefinition.setWarningGroupId(warningGroupId);
processDefinitionMapper.updateById(processDefinition);
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.START_PROCESS_INSTANCE_ERROR);
}
return result;
}
/**
* check whether master exists
*
* @param result result
* @return master exists return true , otherwise return false
*/
private boolean checkMasterExists(Map<String, Object> result) {
List<Server> masterServers = monitorService.getServerListFromRegistry(true);
if (masterServers.isEmpty()) {
putMsg(result, Status.MASTER_NOT_EXISTS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | return false;
}
return true;
}
/**
* check whether the process definition can be executed
*
* @param projectCode project code
* @param processDefinition process definition
* @param processDefineCode process definition code
* @param version process instance verison
* @return check result code
*/
@Override
public Map<String, Object> checkProcessDefinitionValid(long projectCode, ProcessDefinition processDefinition, long processDefineCode, Integer version) {
Map<String, Object> result = new HashMap<>();
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode));
} else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, String.valueOf(processDefineCode), version);
} else if (!checkSubProcessDefinitionValid(processDefinition)){
putMsg(result, Status.SUB_PROCESS_DEFINE_NOT_RELEASE);
} else {
result.put(Constants.STATUS, Status.SUCCESS);
}
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | /**
* check if the current process has subprocesses and all subprocesses are valid
* @param processDefinition
* @return check result
*/
@Override
public boolean checkSubProcessDefinitionValid(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryDownstreamByProcessDefinitionCode(processDefinition.getCode());
if (processTaskRelations.isEmpty()){
return true;
}
Set<Long> relationCodes = processTaskRelations.stream().map(ProcessTaskRelation::getPostTaskCode).collect(Collectors.toSet());
List<TaskDefinition> taskDefinitions = taskDefinitionMapper.queryByCodeList(relationCodes);
Set<Long> processDefinitionCodeSet = new HashSet<>();
taskDefinitions.stream()
.filter(task -> TaskConstants.TASK_TYPE_SUB_PROCESS.equalsIgnoreCase(task.getTaskType()))
.forEach(taskDefinition -> processDefinitionCodeSet.add(Long.valueOf(JSONUtils.getNodeString(taskDefinition.getTaskParams(), Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE))));
if (processDefinitionCodeSet.isEmpty()){
return true;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryByCodes(processDefinitionCodeSet);
return processDefinitions.stream().filter(definition -> definition.getReleaseState().equals(ReleaseState.OFFLINE)).collect(Collectors.toSet()).isEmpty();
}
/**
* do action to process instance:pause, stop, repeat, recover from pause, recover from stop
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | * @param projectCode project code
* @param processInstanceId process instance id
* @param executeType execute type
* @return execute result code
*/
@Override
public Map<String, Object> execute(User loginUser, long projectCode, Integer processInstanceId, ExecuteType executeType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (!checkMasterExists(result)) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId);
if (processInstance == null) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
ProcessDefinition processDefinition = processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion());
if (executeType != ExecuteType.STOP && executeType != ExecuteType.PAUSE) {
result = checkProcessDefinitionValid(projectCode, processDefinition, processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion());
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | result = checkExecuteType(processInstance, executeType);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (!checkTenantSuitable(processDefinition)) {
logger.error("there is not any valid tenant for the process definition: id:{},name:{}, ",
processDefinition.getId(), processDefinition.getName());
putMsg(result, Status.TENANT_NOT_SUITABLE);
}
//
Map<String, Object> commandMap = JSONUtils.parseObject(processInstance.getCommandParam(), new TypeReference<Map<String, Object>>() {});
String startParams = null;
if (MapUtils.isNotEmpty(commandMap) && executeType == ExecuteType.REPEAT_RUNNING) {
Object startParamsJson = commandMap.get(Constants.CMD_PARAM_START_PARAMS);
if (startParamsJson != null) {
startParams = startParamsJson.toString();
}
}
switch (executeType) {
case REPEAT_RUNNING:
result = insertCommand(loginUser, processInstanceId, processDefinition.getCode(), processDefinition.getVersion(), CommandType.REPEAT_RUNNING, startParams);
break;
case RECOVER_SUSPENDED_PROCESS:
result = insertCommand(loginUser, processInstanceId, processDefinition.getCode(), processDefinition.getVersion(), CommandType.RECOVER_SUSPENDED_PROCESS, startParams);
break;
case START_FAILURE_TASK_PROCESS:
result = insertCommand(loginUser, processInstanceId, processDefinition.getCode(), processDefinition.getVersion(), CommandType.START_FAILURE_TASK_PROCESS, startParams);
break;
case STOP:
if (processInstance.getState() == ExecutionStatus.READY_STOP) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState());
} else {
result = updateProcessInstancePrepare(processInstance, CommandType.STOP, ExecutionStatus.READY_STOP);
}
break;
case PAUSE:
if (processInstance.getState() == ExecutionStatus.READY_PAUSE) {
putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState());
} else {
result = updateProcessInstancePrepare(processInstance, CommandType.PAUSE, ExecutionStatus.READY_PAUSE);
}
break;
default:
logger.error("unknown execute type : {}", executeType);
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type");
break;
}
return result;
}
@Override
public Map<String, Object> forceStartTaskInstance(User loginUser, int queueId) {
Map<String, Object> result = new HashMap<>();
TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.selectById(queueId);
//
ProcessInstance processInstance = processInstanceMapper.selectById(taskGroupQueue.getProcessId());
if (processInstance == null) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, taskGroupQueue.getProcessId());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | if (!checkMasterExists(result)) {
return result;
}
return forceStart(processInstance, taskGroupQueue);
}
/**
* check tenant suitable
*
* @param processDefinition process definition
* @return true if tenant suitable, otherwise return false
*/
private boolean checkTenantSuitable(ProcessDefinition processDefinition) {
Tenant tenant = processService.getTenantForProcess(processDefinition.getTenantId(),
processDefinition.getUserId());
return tenant != null;
}
/**
* Check the state of process instance and the type of operation match
*
* @param processInstance process instance
* @param executeType execute type
* @return check result code
*/
private Map<String, Object> checkExecuteType(ProcessInstance processInstance, ExecuteType executeType) {
Map<String, Object> result = new HashMap<>();
ExecutionStatus executionStatus = processInstance.getState();
boolean checkResult = false;
switch (executeType) {
case PAUSE:
case STOP: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | if (executionStatus.typeIsRunning()) {
checkResult = true;
}
break;
case REPEAT_RUNNING:
if (executionStatus.typeIsFinished()) {
checkResult = true;
}
break;
case START_FAILURE_TASK_PROCESS:
if (executionStatus.typeIsFailure()) {
checkResult = true;
}
break;
case RECOVER_SUSPENDED_PROCESS:
if (executionStatus.typeIsPause() || executionStatus.typeIsCancel()) {
checkResult = true;
}
break;
default:
break;
}
if (!checkResult) {
putMsg(result, Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(), executionStatus.toString(), executeType.toString());
} else {
putMsg(result, Status.SUCCESS);
}
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | * prepare to update process instance command type and status
*
* @param processInstance process instance
* @param commandType command type
* @param executionStatus execute status
* @return update result
*/
private Map<String, Object> updateProcessInstancePrepare(ProcessInstance processInstance, CommandType commandType, ExecutionStatus executionStatus) {
Map<String, Object> result = new HashMap<>();
processInstance.setCommandType(commandType);
processInstance.addHistoryCmd(commandType);
processInstance.setState(executionStatus);
int update = processService.updateProcessInstance(processInstance);
//
if (update > 0) {
String host = processInstance.getHost();
String address = host.split(":")[0];
int port = Integer.parseInt(host.split(":")[1]);
StateEventChangeCommand stateEventChangeCommand = new StateEventChangeCommand(
processInstance.getId(), 0, processInstance.getState(), processInstance.getId(), 0
);
stateEventCallbackService.sendResult(address, port, stateEventChangeCommand.convert2Command());
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR);
}
return result;
}
/**
* prepare to update process instance command type and status |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | *
* @param processInstance process instance
* @return update result
*/
private Map<String, Object> forceStart(ProcessInstance processInstance, TaskGroupQueue taskGroupQueue) {
Map<String, Object> result = new HashMap<>();
if (taskGroupQueue.getStatus() != TaskGroupQueueStatus.WAIT_QUEUE) {
putMsg(result, Status.TASK_GROUP_QUEUE_ALREADY_START);
return result;
}
taskGroupQueue.setForceStart(Flag.YES.getCode());
processService.updateTaskGroupQueue(taskGroupQueue);
processService.sendStartTask2Master(processInstance, taskGroupQueue.getTaskId()
,org.apache.dolphinscheduler.remote.command.CommandType.TASK_FORCE_STATE_EVENT_REQUEST);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* insert command, used in the implementation of the page, re run, recovery (pause / failure) execution
*
* @param loginUser login user
* @param instanceId instance id
* @param processDefinitionCode process definition code
* @param processVersion
* @param commandType command type
* @return insert result code
*/
private Map<String, Object> insertCommand(User loginUser, Integer instanceId, long processDefinitionCode, int processVersion, CommandType commandType, String startParams) {
Map<String, Object> result = new HashMap<>();
// |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | Map<String, Object> cmdParam = new HashMap<>();
cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, instanceId);
if (!StringUtils.isEmpty(startParams)) {
cmdParam.put(CMD_PARAM_START_PARAMS, startParams);
}
Command command = new Command();
command.setCommandType(commandType);
command.setProcessDefinitionCode(processDefinitionCode);
command.setCommandParam(JSONUtils.toJsonString(cmdParam));
command.setExecutorId(loginUser.getId());
command.setProcessDefinitionVersion(processVersion);
command.setProcessInstanceId(instanceId);
if (!processService.verifyIsNeedCreateCommand(command)) {
putMsg(result, Status.PROCESS_INSTANCE_EXECUTING_COMMAND, String.valueOf(processDefinitionCode));
return result;
}
int create = processService.createCommand(command);
if (create > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR);
}
return result;
}
/**
* check if sub processes are offline before starting process definition
*
* @param processDefinitionCode process definition code
* @return check result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | @Override
public Map<String, Object> startCheckByProcessDefinedCode(long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null) {
logger.error("process definition is not found");
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "processDefinitionCode");
return result;
}
List<Long> codes = new ArrayList<>();
processService.recurseFindSubProcess(processDefinition.getCode(), codes);
if (!codes.isEmpty()) {
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(codes);
if (processDefinitionList != null) {
for (ProcessDefinition processDefinitionTmp : processDefinitionList) {
/**
* if there is no online process, exit directly
*/
if (processDefinitionTmp.getReleaseState() != ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefinitionTmp.getName());
logger.info("not release process definition id: {} , name : {}",
processDefinitionTmp.getId(), processDefinitionTmp.getName());
return result;
}
}
}
}
putMsg(result, Status.SUCCESS);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | /**
* create command
*
* @param commandType commandType
* @param processDefineCode processDefineCode
* @param nodeDep nodeDep
* @param failureStrategy failureStrategy
* @param startNodeList startNodeList
* @param schedule schedule
* @param warningType warningType
* @param executorId executorId
* @param warningGroupId warningGroupId
* @param runMode runMode
* @param processInstancePriority processInstancePriority
* @param workerGroup workerGroup
* @param environmentCode environmentCode
* @return command id
*/
private int createCommand(CommandType commandType, long processDefineCode,
TaskDependType nodeDep, FailureStrategy failureStrategy,
String startNodeList, String schedule, WarningType warningType,
int executorId, int warningGroupId,
RunMode runMode, Priority processInstancePriority, String workerGroup, Long environmentCode,
Map<String, String> startParams, Integer expectedParallelismNumber, int dryRun, ComplementDependentMode complementDependentMode) {
/**
* instantiate command schedule instance
*/
Command command = new Command();
Map<String, String> cmdParam = new HashMap<>();
if (commandType == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | command.setCommandType(CommandType.START_PROCESS);
} else {
command.setCommandType(commandType);
}
command.setProcessDefinitionCode(processDefineCode);
if (nodeDep != null) {
command.setTaskDependType(nodeDep);
}
if (failureStrategy != null) {
command.setFailureStrategy(failureStrategy);
}
if (!StringUtils.isEmpty(startNodeList)) {
cmdParam.put(CMD_PARAM_START_NODES, startNodeList);
}
if (warningType != null) {
command.setWarningType(warningType);
}
if (startParams != null && startParams.size() > 0) {
cmdParam.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(startParams));
}
command.setCommandParam(JSONUtils.toJsonString(cmdParam));
command.setExecutorId(executorId);
command.setWarningGroupId(warningGroupId);
command.setProcessInstancePriority(processInstancePriority);
command.setWorkerGroup(workerGroup);
command.setEnvironmentCode(environmentCode);
command.setDryRun(dryRun);
ProcessDefinition processDefinition = processService.findProcessDefinitionByCode(processDefineCode);
if (processDefinition != null) {
command.setProcessDefinitionVersion(processDefinition.getVersion()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | }
command.setProcessInstanceId(0);
Date start = null;
Date end = null;
if (!StringUtils.isEmpty(schedule)) {
String[] interval = schedule.split(",");
if (interval.length == 2) {
start = DateUtils.getScheduleDate(interval[0]);
end = DateUtils.getScheduleDate(interval[1]);
if (start.after(end)) {
logger.info("complement data error, wrong date start:{} and end date:{} ",
start, end
);
return 0;
}
}
}
//
if (commandType == CommandType.COMPLEMENT_DATA) {
if (start == null || end == null) {
return 0;
}
return createComplementCommandList(start, end, runMode, command, expectedParallelismNumber, complementDependentMode);
} else {
command.setCommandParam(JSONUtils.toJsonString(cmdParam));
return processService.createCommand(command);
}
}
/**
* create complement command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | * close left and close right
*
* @param start
* @param end
* @param runMode
* @return
*/
protected int createComplementCommandList(Date start, Date end, RunMode runMode, Command command,
Integer expectedParallelismNumber, ComplementDependentMode complementDependentMode) {
int createCount = 0;
int dependentProcessDefinitionCreateCount = 0;
runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode;
Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam());
switch (runMode) {
case RUN_MODE_SERIAL: {
if (start.after(end)) {
logger.warn("The startDate {} is later than the endDate {}", start, end);
break;
}
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(start));
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(end));
command.setCommandParam(JSONUtils.toJsonString(cmdParam));
createCount = processService.createCommand(command);
//
List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode(command.getProcessDefinitionCode());
if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) {
logger.info("process code: {} complement dependent in off mode or schedule's size is 0, skip "
+ "dependent complement data", command.getProcessDefinitionCode());
} else {
dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | }
break;
}
case RUN_MODE_PARALLEL: {
if (start.after(end)) {
logger.warn("The startDate {} is later than the endDate {}", start, end);
break;
}
List<Date> listDate = new ArrayList<>();
List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode(command.getProcessDefinitionCode());
listDate.addAll(CronUtils.getSelfFireDateList(start, end, schedules));
int listDateSize = listDate.size();
createCount = listDate.size();
if (!CollectionUtils.isEmpty(listDate)) {
if (expectedParallelismNumber != null && expectedParallelismNumber != 0) {
createCount = Math.min(listDate.size(), expectedParallelismNumber);
if (listDateSize < createCount) {
createCount = listDateSize;
}
}
logger.info("In parallel mode, current expectedParallelismNumber:{}", createCount);
//
//
int itemsPerCommand = (listDateSize / createCount);
int remainingItems = (listDateSize % createCount);
int startDateIndex = 0;
int endDateIndex = 0;
for (int i = 1; i <= createCount; i++) {
int extra = (i <= remainingItems) ? 1 : 0; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | int singleCommandItems = (itemsPerCommand + extra);
if (i == 1) {
endDateIndex += singleCommandItems - 1;
} else {
startDateIndex = endDateIndex + 1;
endDateIndex += singleCommandItems;
}
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(listDate.get(startDateIndex)));
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(listDate.get(endDateIndex)));
command.setCommandParam(JSONUtils.toJsonString(cmdParam));
processService.createCommand(command);
if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) {
logger.info("process code: {} complement dependent in off mode or schedule's size is 0, skip "
+ "dependent complement data", command.getProcessDefinitionCode());
} else {
dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command);
}
}
}
break;
}
default:
break;
}
logger.info("create complement command count: {}, create dependent complement command count: {}", createCount
, dependentProcessDefinitionCreateCount);
return createCount;
}
/**
* create complement dependent command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | */
protected int createComplementDependentCommand(List<Schedule> schedules, Command command) {
int dependentProcessDefinitionCreateCount = 0;
Command dependentCommand;
try {
dependentCommand = (Command) BeanUtils.cloneBean(command);
} catch (Exception e) {
logger.error("copy dependent command error: ", e);
return dependentProcessDefinitionCreateCount;
}
List<DependentProcessDefinition> dependentProcessDefinitionList =
getComplementDependentDefinitionList(dependentCommand.getProcessDefinitionCode(),
CronUtils.getMaxCycle(schedules.get(0).getCrontab()),
dependentCommand.getWorkerGroup());
dependentCommand.setTaskDependType(TaskDependType.TASK_POST);
for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) {
dependentCommand.setProcessDefinitionCode(dependentProcessDefinition.getProcessDefinitionCode());
dependentCommand.setWorkerGroup(dependentProcessDefinition.getWorkerGroup());
Map<String, String> cmdParam = JSONUtils.toMap(dependentCommand.getCommandParam());
cmdParam.put(CMD_PARAM_START_NODES, String.valueOf(dependentProcessDefinition.getTaskDefinitionCode()));
dependentCommand.setCommandParam(JSONUtils.toJsonString(cmdParam));
dependentProcessDefinitionCreateCount += processService.createCommand(dependentCommand);
}
return dependentProcessDefinitionCreateCount;
}
/**
* get complement list
*/
private List<DependentProcessDefinition> getComplementDependentDefinitionList(long processDefinitionCode,
CycleEnum processDefinitionCycle, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java | String workerGroup) {
List<DependentProcessDefinition> dependentProcessDefinitionList =
processService.queryDependentProcessDefinitionByProcessDefinitionCode(processDefinitionCode);
return checkDependentProcessDefinitionValid(dependentProcessDefinitionList,processDefinitionCycle,workerGroup);
}
/**
* Check whether the dependency cycle of the dependent node is consistent with the schedule cycle of
* the and if there is no worker group in the schedule, use the complement selection's
* worker group
*/
private List<DependentProcessDefinition> checkDependentProcessDefinitionValid(List<DependentProcessDefinition> dependentProcessDefinitionList,
CycleEnum processDefinitionCycle,
String workerGroup) {
List<DependentProcessDefinition> validDependentProcessDefinitionList = new ArrayList<>();
List<Long> processDefinitionCodeList = dependentProcessDefinitionList.stream()
.map(DependentProcessDefinition::getProcessDefinitionCode)
.collect(Collectors.toList());
Map<Long, String> processDefinitionWorkerGroupMap = processService.queryWorkerGroupByProcessDefinitionCodes(processDefinitionCodeList);
for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) {
if (dependentProcessDefinition.getDependentCycle() == processDefinitionCycle) {
if (processDefinitionWorkerGroupMap.get(dependentProcessDefinition.getProcessDefinitionCode()) == null) {
dependentProcessDefinition.setWorkerGroup(workerGroup);
}
validDependentProcessDefinitionList.add(dependentProcessDefinition);
}
}
return validDependentProcessDefinitionList;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import org.apache.dolphinscheduler.api.dto.ScheduleParam;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.MonitorService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.model.Server;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.quartz.ProcessScheduleJob;
import org.apache.dolphinscheduler.service.quartz.QuartzExecutor;
import org.apache.dolphinscheduler.service.quartz.impl.QuartzExecutorImpl;
import org.apache.dolphinscheduler.service.quartz.cron.CronUtils;
import org.apache.commons.lang.StringUtils;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.quartz.CronExpression;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* scheduler service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerService {
private static final Logger logger = LoggerFactory.getLogger(SchedulerServiceImpl.class);
@Autowired
private ProjectService projectService;
@Autowired
private ExecutorService executorService;
@Autowired
private MonitorService monitorService;
@Autowired
private ProcessService processService;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private Scheduler scheduler;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private QuartzExecutor quartzExecutor;
/**
* save schedule
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | * @param loginUser login user
* @param projectCode project name
* @param processDefineCode process definition code
* @param schedule scheduler
* @param warningType warning type
* @param warningGroupId warning group id
* @param failureStrategy failure strategy
* @param processInstancePriority process instance priority
* @param workerGroup worker group
* @param environmentCode environment code
* @return create result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> insertSchedule(User loginUser,
long projectCode,
long processDefineCode,
String schedule,
WarningType warningType,
int warningGroupId,
FailureStrategy failureStrategy,
Priority processInstancePriority,
String workerGroup,
Long environmentCode) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result);
if (!hasProjectAndPerm) {
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | }
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode);
result = executorService.checkProcessDefinitionValid(projectCode,processDefinition, processDefineCode, processDefinition.getVersion());
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Schedule scheduleObj = new Schedule();
Date now = new Date();
scheduleObj.setProjectName(project.getName());
scheduleObj.setProcessDefinitionCode(processDefineCode);
scheduleObj.setProcessDefinitionName(processDefinition.getName());
ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class);
if (DateUtils.differSec(scheduleParam.getStartTime(), scheduleParam.getEndTime()) == 0) {
logger.warn("The start time must not be the same as the end");
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result;
}
if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
logger.warn("The start time must smaller than end time");
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
return result;
}
scheduleObj.setStartTime(scheduleParam.getStartTime());
scheduleObj.setEndTime(scheduleParam.getEndTime());
if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {
logger.error("{} verify failure", scheduleParam.getCrontab());
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleParam.getCrontab());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | scheduleObj.setCrontab(scheduleParam.getCrontab());
scheduleObj.setTimezoneId(scheduleParam.getTimezoneId());
scheduleObj.setWarningType(warningType);
scheduleObj.setWarningGroupId(warningGroupId);
scheduleObj.setFailureStrategy(failureStrategy);
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setUserName(loginUser.getUserName());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setProcessInstancePriority(processInstancePriority);
scheduleObj.setWorkerGroup(workerGroup);
scheduleObj.setEnvironmentCode(environmentCode);
scheduleMapper.insert(scheduleObj);
/**
* updateProcessInstance receivers and cc by process definition id
*/
processDefinition.setWarningGroupId(warningGroupId);
processDefinitionMapper.updateById(processDefinition);
result.put(Constants.DATA_LIST, scheduleMapper.selectById(scheduleObj.getId()));
putMsg(result, Status.SUCCESS);
result.put("scheduleId", scheduleObj.getId());
return result;
}
/**
* updateProcessInstance schedule
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | * @param id scheduler id
* @param scheduleExpression scheduler
* @param warningType warning type
* @param warningGroupId warning group id
* @param failureStrategy failure strategy
* @param workerGroup worker group
* @param environmentCode environment code
* @param processInstancePriority process instance priority
* @return update result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> updateSchedule(User loginUser,
long projectCode,
Integer id,
String scheduleExpression,
WarningType warningType,
int warningGroupId,
FailureStrategy failureStrategy,
Priority processInstancePriority,
String workerGroup,
Long environmentCode) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result);
if (!hasProjectAndPerm) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | Schedule schedule = scheduleMapper.selectById(id);
if (schedule == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, id);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(schedule.getProcessDefinitionCode());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(schedule.getProcessDefinitionCode()));
return result;
}
updateSchedule(result, schedule, processDefinition, scheduleExpression, warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode);
return result;
}
/**
* set schedule online or offline
*
* @param loginUser login user
* @param projectCode project code
* @param id scheduler id
* @param scheduleStatus schedule status
* @return publish result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> setScheduleState(User loginUser,
long projectCode,
Integer id,
ReleaseState scheduleStatus) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result);
if (!hasProjectAndPerm) {
return result;
}
Schedule scheduleObj = scheduleMapper.selectById(id);
if (scheduleObj == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, id);
return result;
}
if (scheduleObj.getReleaseState() == scheduleStatus) {
logger.info("schedule release is already {},needn't to change schedule id: {} from {} to {}",
scheduleObj.getReleaseState(), scheduleObj.getId(), scheduleObj.getReleaseState(), scheduleStatus);
putMsg(result, Status.SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE, scheduleStatus);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(scheduleObj.getProcessDefinitionCode());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(scheduleObj.getProcessDefinitionCode()));
return result;
}
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, scheduleObj.getProcessDefinitionCode());
if (processTaskRelations.isEmpty()) {
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (scheduleStatus == ReleaseState.ONLINE) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | if (processDefinition.getReleaseState() != ReleaseState.ONLINE) {
logger.info("not release process definition id: {} , name : {}",
processDefinition.getId(), processDefinition.getName());
putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefinition.getName());
return result;
}
List<Long> subProcessDefineCodes = new ArrayList<>();
processService.recurseFindSubProcess(processDefinition.getCode(), subProcessDefineCodes);
if (!subProcessDefineCodes.isEmpty()) {
List<ProcessDefinition> subProcessDefinitionList =
processDefinitionMapper.queryByCodes(subProcessDefineCodes);
if (subProcessDefinitionList != null && !subProcessDefinitionList.isEmpty()) {
for (ProcessDefinition subProcessDefinition : subProcessDefinitionList) {
/**
* if there is no online process, exit directly
*/
if (subProcessDefinition.getReleaseState() != ReleaseState.ONLINE) {
logger.info("not release process definition id: {} , name : {}",
subProcessDefinition.getId(), subProcessDefinition.getName());
putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, String.valueOf(subProcessDefinition.getId()));
return result;
}
}
}
}
}
List<Server> masterServers = monitorService.getServerListFromRegistry(true);
if (masterServers.isEmpty()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | putMsg(result, Status.MASTER_NOT_EXISTS);
return result;
}
scheduleObj.setReleaseState(scheduleStatus);
scheduleMapper.updateById(scheduleObj);
try {
switch (scheduleStatus) {
case ONLINE:
logger.info("Call master client set schedule online, project id: {}, flow id: {},host: {}", project.getId(), processDefinition.getId(), masterServers);
setSchedule(project.getId(), scheduleObj);
break;
case OFFLINE:
logger.info("Call master client set schedule offline, project id: {}, flow id: {},host: {}", project.getId(), processDefinition.getId(), masterServers);
deleteSchedule(project.getId(), id);
break;
default:
putMsg(result, Status.SCHEDULE_STATUS_UNKNOWN, scheduleStatus.toString());
return result;
}
} catch (Exception e) {
result.put(Constants.MSG, scheduleStatus == ReleaseState.ONLINE ? "set online failure" : "set offline failure");
throw new ServiceException(result.get(Constants.MSG).toString(), e);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query schedule
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | * @param loginUser login user
* @param projectCode project code
* @param processDefineCode process definition code
* @param pageNo page number
* @param pageSize page size
* @param searchVal search value
* @return schedule list page
*/
@Override
public Result querySchedule(User loginUser, long projectCode, long processDefineCode, String searchVal,
Integer pageNo, Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result);
if (!hasProjectAndPerm) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode));
return result;
}
Page<Schedule> page = new Page<>(pageNo, pageSize);
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProcessDefineCodePaging(page, processDefineCode,
searchVal);
PageInfo<Schedule> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) scheduleIPage.getTotal());
pageInfo.setTotalList(scheduleIPage.getRecords());
result.setData(pageInfo); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | putMsg(result, Status.SUCCESS);
return result;
}
/**
* query schedule list
*
* @param loginUser login user
* @param projectCode project code
* @return schedule list
*/
@Override
public Map<String, Object> queryScheduleList(User loginUser, long projectCode) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result);
if (!hasProjectAndPerm) {
return result;
}
List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(project.getName());
result.put(Constants.DATA_LIST, schedules);
putMsg(result, Status.SUCCESS);
return result;
}
public void setSchedule(int projectId, Schedule schedule) {
logger.info("set schedule, project id: {}, scheduleId: {}", projectId, schedule.getId());
quartzExecutor.addJob(ProcessScheduleJob.class, projectId, schedule);
}
/**
* delete schedule |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | *
* @param projectId project id
* @param scheduleId schedule id
* @throws RuntimeException runtime exception
*/
@Override
public void deleteSchedule(int projectId, int scheduleId) {
logger.info("delete schedules of project id:{}, schedule id:{}", projectId, scheduleId);
String jobName = quartzExecutor.buildJobName(scheduleId);
String jobGroupName = quartzExecutor.buildJobGroupName(projectId);
JobKey jobKey = new JobKey(jobName, jobGroupName);
try {
if (scheduler.checkExists(jobKey)) {
logger.info("Try to delete job: {}, group name: {},", jobName, jobGroupName);
scheduler.deleteJob(jobKey);
}
} catch (SchedulerException e) {
logger.error("Failed to delete job: {}", jobKey);
throw new ServiceException("Failed to delete job: " + jobKey);
}
}
/**
* check valid
*
* @param result result
* @param bool bool
* @param status status
* @return check result code
*/
private boolean checkValid(Map<String, Object> result, boolean bool, Status status) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | if (bool) {
putMsg(result, status);
return true;
}
return false;
}
/**
* delete schedule by id
*
* @param loginUser login user
* @param projectCode project code
* @param scheduleId scheule id
* @return delete result code
*/
@Override
public Map<String, Object> deleteScheduleById(User loginUser, long projectCode, Integer scheduleId) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
Schedule schedule = scheduleMapper.selectById(scheduleId);
if (schedule == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, scheduleId);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | if (loginUser.getId() != schedule.getUserId()
&& loginUser.getUserType() != UserType.ADMIN_USER) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (schedule.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId());
return result;
}
int delete = scheduleMapper.deleteById(scheduleId);
if (delete > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
}
return result;
}
/**
* preview schedule
*
* @param loginUser login user
* @param schedule schedule expression
* @return the next five fire time
*/
@Override
public Map<String, Object> previewSchedule(User loginUser, String schedule) {
Map<String, Object> result = new HashMap<>();
CronExpression cronExpression;
ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | Date now = new Date();
Date startTime = now.after(scheduleParam.getStartTime()) ? now : scheduleParam.getStartTime();
Date endTime = scheduleParam.getEndTime();
try {
cronExpression = CronUtils.parse2CronExpression(scheduleParam.getCrontab());
} catch (ParseException e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.PARSE_TO_CRON_EXPRESSION_ERROR);
return result;
}
List<Date> selfFireDateList = CronUtils.getSelfFireDateList(startTime, endTime, cronExpression, Constants.PREVIEW_SCHEDULE_EXECUTE_COUNT);
List<String> previewDateList = new ArrayList<>();
selfFireDateList.forEach(date -> previewDateList.add(DateUtils.dateToString(date, scheduleParam.getTimezoneId())));
result.put(Constants.DATA_LIST, previewDateList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process definition schedule
*
* @param loginUser login user
* @param projectCode project code
* @param processDefinitionCode process definition code
* @param scheduleExpression scheduleExpression
* @param warningType warning type
* @param warningGroupId warning group id
* @param failureStrategy failure strategy
* @param workerGroup worker group
* @param processInstancePriority process instance priority
* @return update result code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | */
@Override
public Map<String, Object> updateScheduleByProcessDefinitionCode(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleExpression,
WarningType warningType,
int warningGroupId,
FailureStrategy failureStrategy,
Priority processInstancePriority,
String workerGroup,
long environmentCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode);
if (schedule == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, processDefinitionCode);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode));
return result;
}
updateSchedule(result, schedule, processDefinition, scheduleExpression, warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | return result;
}
private void updateSchedule(Map<String, Object> result,
Schedule schedule,
ProcessDefinition processDefinition,
String scheduleExpression,
WarningType warningType,
int warningGroupId,
FailureStrategy failureStrategy,
Priority processInstancePriority,
String workerGroup,
long environmentCode) {
if (checkValid(result, schedule.getReleaseState() == ReleaseState.ONLINE, Status.SCHEDULE_CRON_ONLINE_FORBID_UPDATE)) {
return;
}
Date now = new Date();
if (!StringUtils.isEmpty(scheduleExpression)) {
ScheduleParam scheduleParam = JSONUtils.parseObject(scheduleExpression, ScheduleParam.class);
if (scheduleParam == null) {
putMsg(result, Status.PARSE_TO_CRON_EXPRESSION_ERROR);
return;
}
if (DateUtils.differSec(scheduleParam.getStartTime(), scheduleParam.getEndTime()) == 0) {
logger.warn("The start time must not be the same as the end");
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return;
}
if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
logger.warn("The start time must smaller than end time"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java | putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
return;
}
schedule.setStartTime(scheduleParam.getStartTime());
schedule.setEndTime(scheduleParam.getEndTime());
if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {
putMsg(result, Status.SCHEDULE_CRON_CHECK_FAILED, scheduleParam.getCrontab());
return;
}
schedule.setCrontab(scheduleParam.getCrontab());
schedule.setTimezoneId(scheduleParam.getTimezoneId());
}
if (warningType != null) {
schedule.setWarningType(warningType);
}
schedule.setWarningGroupId(warningGroupId);
if (failureStrategy != null) {
schedule.setFailureStrategy(failureStrategy);
}
schedule.setWorkerGroup(workerGroup);
schedule.setEnvironmentCode(environmentCode);
schedule.setUpdateTime(now);
schedule.setProcessInstancePriority(processInstancePriority);
scheduleMapper.updateById(schedule);
processDefinition.setWarningGroupId(warningGroupId);
processDefinitionMapper.updateById(processDefinition);
putMsg(result, Status.SUCCESS);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.thread.ThreadLocalContext; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java | import org.apache.commons.lang.StringUtils;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class DateUtils {
static final long C0 = 1L;
static final long C1 = C0 * 1000L;
static final long C2 = C1 * 1000L;
static final long C3 = C2 * 1000L;
static final long C4 = C3 * 60L;
static final long C5 = C4 * 60L;
static final long C6 = C5 * 24L;
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
private static final DateTimeFormatter YYYY_MM_DD_HH_MM_SS = DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS);
private DateUtils() {
throw new UnsupportedOperationException("Construct DateUtils");
}
/**
* date to local datetime
*
* @param date date
* @return local datetime
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java | private static LocalDateTime date2LocalDateTime(Date date) {
String timezone = ThreadLocalContext.getTimezoneThreadLocal().get();
ZoneId zoneId = StringUtils.isNotEmpty(timezone) ? ZoneId.of(timezone) : ZoneId.systemDefault();
return date2LocalDateTime(date, zoneId);
}
/**
* date to local datetime
*
* @param date date
* @param zoneId zoneId
* @return local datetime
*/
private static LocalDateTime date2LocalDateTime(Date date, ZoneId zoneId) {
return LocalDateTime.ofInstant(date.toInstant(), zoneId);
}
/**
* local datetime to date
*
* @param localDateTime local datetime
* @return date
*/
private static Date localDateTime2Date(LocalDateTime localDateTime) {
String timezone = ThreadLocalContext.getTimezoneThreadLocal().get();
ZoneId zoneId = StringUtils.isNotEmpty(timezone) ? ZoneId.of(timezone) : ZoneId.systemDefault();
return localDateTime2Date(localDateTime, zoneId);
}
/**
* local datetime to date
*
* @param localDateTime local datetime |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java | * @return date
*/
private static Date localDateTime2Date(LocalDateTime localDateTime, ZoneId zoneId) {
Instant instant = localDateTime.atZone(zoneId).toInstant();
return Date.from(instant);
}
/**
* get the date string in the specified format of the current time
*
* @param format date format
* @return date string
*/
public static String getCurrentTime(String format) {
return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format));
}
/**
* get the formatted date string
*
* @param date date
* @param format e.g. yyyy-MM-dd HH:mm:ss
* @return date string
*/
public static String format(Date date, String format, String timezone) {
return format(date, DateTimeFormatter.ofPattern(format), timezone);
}
public static String format(Date date, DateTimeFormatter dateTimeFormatter, String timezone) {
LocalDateTime localDateTime = StringUtils.isEmpty(timezone) ? date2LocalDateTime(date) : date2LocalDateTime(date, ZoneId.of(timezone));
return format(localDateTime, dateTimeFormatter);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java | * get the formatted date string
*
* @param localDateTime local data time
* @param format yyyy-MM-dd HH:mm:ss
* @return date string
*/
public static String format(LocalDateTime localDateTime, String format) {
return format(localDateTime, DateTimeFormatter.ofPattern(format));
}
public static String format(LocalDateTime localDateTime, DateTimeFormatter dateTimeFormatter) {
return localDateTime.format(dateTimeFormatter);
}
/**
* convert time to yyyy-MM-dd HH:mm:ss format
*
* @param date date
* @return date string
*/
public static String dateToString(Date date) {
return format(date, YYYY_MM_DD_HH_MM_SS, null);
}
/**
* convert time to yyyy-MM-dd HH:mm:ss format
*
* @param date date
* @param timezone timezone
* @return date string
*/
public static String dateToString(Date date, String timezone) {
return format(date, YYYY_MM_DD_HH_MM_SS, timezone); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,829 | [Bug] [Api] scheduler time error when change timezone | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
schedule time correct.
### How to reproduce
create a schedule in UTC timezone, and then change timezone to Asia/Shanghai
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9829 | https://github.com/apache/dolphinscheduler/pull/9830 | d1f5bbfcae3659c885a20e4ea9f0e05001f2db42 | 5d5125d50760ac7846d78b12c270143bbbe5a037 | 2022-04-28T07:44:47Z | java | 2022-04-29T02:17:34Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java | }
/**
* convert string to date and time
*
* @param date date
* @param format format
* @param timezone timezone, if null, use system default timezone
* @return date
*/
public static Date parse(String date, String format, String timezone) {
return parse(date, DateTimeFormatter.ofPattern(format), timezone);
}
public static Date parse(String date, DateTimeFormatter dateTimeFormatter, String timezone) {
try {
LocalDateTime ldt = LocalDateTime.parse(date, dateTimeFormatter);
if (StringUtils.isEmpty(timezone)) {
return localDateTime2Date(ldt);
}
return localDateTime2Date(ldt, ZoneId.of(timezone));
} catch (Exception e) {
logger.error("error while parse date:" + date, e);
}
return null;
}
/**
* convert date str to yyyy-MM-dd HH:mm:ss format
*
* @param date date string
* @return yyyy-MM-dd HH:mm:ss format
*/ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.