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
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
@Autowired NettyExecutorManager nettyExecutorManager; /** * master prepare exec service */ private ThreadPoolExecutor masterPrepareExecService; /** * workflow exec service */ @Autowired private WorkflowExecuteThreadPool workflowExecuteThreadPool; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; @Autowired private StateWheelExecuteThread stateWheelExecuteThread; /** * constructor of MasterSchedulerService */ public void init() { this.masterPrepareExecService = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("Master-Pre-Exec-Thread", masterConfig.getPreExecThreads()); NettyClientConfig clientConfig = new NettyClientConfig(); this.nettyRemotingClient = new NettyRemotingClient(clientConfig); } @Override public synchronized void start() { super.setName("MasterSchedulerService"); super.start(); this.stateWheelExecuteThread.start(); } public void close() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
nettyRemotingClient.close(); logger.info("master schedule service stopped..."); } /** * run of MasterSchedulerService */ @Override public void run() { logger.info("master scheduler started"); while (Stopper.isRunning()) { try { boolean runCheckFlag = OSUtils.checkResource(masterConfig.getMaxCpuLoadAvg(), masterConfig.getReservedMemory()); if (!runCheckFlag) { MasterServerMetrics.incMasterOverload(); Thread.sleep(Constants.SLEEP_TIME_MILLIS); continue; } scheduleProcess(); } catch (Exception e) { logger.error("master scheduler thread error", e); } } } /** * 1. get command by slot * 2. donot handle command if slot is empty */ private void scheduleProcess() throws Exception { List<Command> commands = findCommands(); if (CollectionUtils.isEmpty(commands)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
Thread.sleep(Constants.SLEEP_TIME_MILLIS); return; } List<ProcessInstance> processInstances = command2ProcessInstance(commands); if (CollectionUtils.isEmpty(processInstances)) { return; } MasterServerMetrics.incMasterConsumeCommand(commands.size()); for (ProcessInstance processInstance : processInstances) { WorkflowExecuteRunnable workflowExecuteRunnable = new WorkflowExecuteRunnable( processInstance , processService , nettyExecutorManager , processAlertManager , masterConfig , stateWheelExecuteThread); this.processInstanceExecCacheManager.cache(processInstance.getId(), workflowExecuteRunnable); if (processInstance.getTimeout() > 0) { stateWheelExecuteThread.addProcess4TimeoutCheck(processInstance); } workflowExecuteThreadPool.startWorkflow(workflowExecuteRunnable); } } private List<ProcessInstance> command2ProcessInstance(List<Command> commands) { List<ProcessInstance> processInstances = Collections.synchronizedList(new ArrayList<>(commands.size())); CountDownLatch latch = new CountDownLatch(commands.size()); for (final Command command : commands) { masterPrepareExecService.execute(() -> { try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
SlotCheckState slotCheckState = slotCheck(command); if (slotCheckState.equals(SlotCheckState.CHANGE) || slotCheckState.equals(SlotCheckState.INJECT)) { logger.info("handle command {} skip, slot check state: {}", command.getId(), slotCheckState); return; } ProcessInstance processInstance = processService.handleCommand(logger, getLocalAddress(), command); if (processInstance != null) { processInstances.add(processInstance); logger.info("handle command {} end, create process instance {}", command.getId(), processInstance.getId()); } } catch (Exception e) { logger.error("handle command {} error ", command.getId(), e); processService.moveToErrorCommand(command, e.toString()); } finally { latch.countDown(); } }); } try { latch.await(); } catch (InterruptedException e) { logger.error("countDownLatch await error ", e); } return processInstances; } private List<Command> findCommands() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
int pageNumber = 0; int pageSize = masterConfig.getFetchCommandNum(); List<Command> result = new ArrayList<>(); if (Stopper.isRunning()) { int thisMasterSlot = ServerNodeManager.getSlot(); int masterCount = ServerNodeManager.getMasterSize(); if (masterCount > 0) { result = processService.findCommandPageBySlot(pageSize, pageNumber, masterCount, thisMasterSlot); } } return result; } private SlotCheckState slotCheck(Command command) { int slot = ServerNodeManager.getSlot(); int masterSize = ServerNodeManager.getMasterSize(); SlotCheckState state; if (masterSize <= 0) { state = SlotCheckState.CHANGE; } else if (command.getId() % masterSize == slot) { state = SlotCheckState.PASS; } else { state = SlotCheckState.INJECT; } return state; } private String getLocalAddress() { return NetUtils.getAddr(masterConfig.getListenPort()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.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. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
package org.apache.dolphinscheduler.server.master.runner; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.StateEvent; import org.apache.dolphinscheduler.common.enums.StateEventType; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.runner.task.TaskInstanceKey; import org.apache.commons.lang3.ThreadUtils; import java.time.Duration; import java.util.Optional; import java.util.concurrent.ConcurrentLinkedQueue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Check thread * 1. timeout task check * 2. dependent task state check * 3. retry task check * 4. timeout process check */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
public class StateWheelExecuteThread extends Thread { private static final Logger logger = LoggerFactory.getLogger(StateWheelExecuteThread.class); /** * process timeout check list */ private ConcurrentLinkedQueue<Integer> processInstanceTimeoutCheckList = new ConcurrentLinkedQueue<>(); /** * task time out check list */ private ConcurrentLinkedQueue<TaskInstanceKey> taskInstanceTimeoutCheckList = new ConcurrentLinkedQueue<>(); /** * task retry check list */ private ConcurrentLinkedQueue<TaskInstanceKey> taskInstanceRetryCheckList = new ConcurrentLinkedQueue<>(); /** * task state check list */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
private ConcurrentLinkedQueue<TaskInstanceKey> taskInstanceStateCheckList = new ConcurrentLinkedQueue<>(); @Autowired private MasterConfig masterConfig; @Autowired private WorkflowExecuteThreadPool workflowExecuteThreadPool; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; @Override public void run() { Duration checkInterval = Duration.ofMillis(masterConfig.getStateWheelInterval() * Constants.SLEEP_TIME_MILLIS); while (Stopper.isRunning()) { try { checkTask4Timeout(); checkTask4Retry(); checkTask4State(); checkProcess4Timeout(); } catch (Exception e) { logger.error("state wheel thread check error:", e); } try { ThreadUtils.sleep(checkInterval); } catch (InterruptedException e) { logger.error("state wheel thread sleep error", e); } } } public void addProcess4TimeoutCheck(ProcessInstance processInstance) { processInstanceTimeoutCheckList.add(processInstance.getId()); } public void removeProcess4TimeoutCheck(ProcessInstance processInstance) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
processInstanceTimeoutCheckList.remove(processInstance.getId()); } private void checkProcess4Timeout() { if (processInstanceTimeoutCheckList.isEmpty()) { return; } for (Integer processInstanceId : processInstanceTimeoutCheckList) { if (processInstanceId == null) { continue; } WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId); if (workflowExecuteThread == null) { logger.warn("can not find workflowExecuteThread, this check event will remove, processInstanceId:{}", processInstanceId); processInstanceTimeoutCheckList.remove(processInstanceId); continue; } ProcessInstance processInstance = workflowExecuteThread.getProcessInstance(); if (processInstance == null) { continue; } long timeRemain = DateUtils.getRemainTime(processInstance.getStartTime(), (long) processInstance.getTimeout() * Constants.SEC_2_MINUTES_TIME_UNIT); if (timeRemain < 0) { addProcessTimeoutEvent(processInstance); processInstanceTimeoutCheckList.remove(processInstance.getId()); } } } public void addTask4TimeoutCheck(ProcessInstance processInstance, TaskInstance taskInstance) { TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance); if (taskInstanceKey == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
logger.error("taskInstanceKey is null"); return; } if (taskInstanceTimeoutCheckList.contains(taskInstanceKey)) { return; } TaskDefinition taskDefinition = taskInstance.getTaskDefine(); if (taskDefinition == null) { logger.error("taskDefinition is null, taskId:{}", taskInstance.getId()); return; } if (TimeoutFlag.OPEN == taskDefinition.getTimeoutFlag()) { taskInstanceTimeoutCheckList.add(taskInstanceKey); } if (taskInstance.isDependTask() || taskInstance.isSubProcess()) { taskInstanceTimeoutCheckList.add(taskInstanceKey); } } public void removeTask4TimeoutCheck(ProcessInstance processInstance, TaskInstance taskInstance) { TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance); if (taskInstanceKey == null) { logger.error("taskInstanceKey is null"); return; } taskInstanceTimeoutCheckList.remove(taskInstanceKey); } public void addTask4RetryCheck(ProcessInstance processInstance, TaskInstance taskInstance) { TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance); if (taskInstanceKey == null) { logger.error("taskInstanceKey is null");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
return; } if (taskInstanceRetryCheckList.contains(taskInstanceKey)) { return; } TaskDefinition taskDefinition = taskInstance.getTaskDefine(); if (taskDefinition == null) { logger.error("taskDefinition is null, taskId:{}", taskInstance.getId()); return; } logger.debug("addTask4RetryCheck, taskCode:{}, processInstanceId:{}", taskInstance.getTaskCode(), taskInstance.getProcessInstanceId()); taskInstanceRetryCheckList.add(taskInstanceKey); } public void removeTask4RetryCheck(ProcessInstance processInstance, TaskInstance taskInstance) { TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance); if (taskInstanceKey == null) { logger.error("taskInstanceKey is null"); return; } taskInstanceRetryCheckList.remove(taskInstanceKey); } public void addTask4StateCheck(ProcessInstance processInstance, TaskInstance taskInstance) { TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance); if (taskInstanceKey == null) { logger.error("taskInstanceKey is null"); return; } if (taskInstanceStateCheckList.contains(taskInstanceKey)) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
if (taskInstance.isDependTask() || taskInstance.isSubProcess()) { taskInstanceStateCheckList.add(taskInstanceKey); } } public void removeTask4StateCheck(ProcessInstance processInstance, TaskInstance taskInstance) { TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance); if (taskInstanceKey == null) { logger.error("taskInstanceKey is null"); return; } taskInstanceStateCheckList.remove(taskInstanceKey); } private void checkTask4Timeout() { if (taskInstanceTimeoutCheckList.isEmpty()) { return; } for (TaskInstanceKey taskInstanceKey : taskInstanceTimeoutCheckList) { int processInstanceId = taskInstanceKey.getProcessInstanceId(); long taskCode = taskInstanceKey.getTaskCode(); WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId); if (workflowExecuteThread == null) { logger.warn("can not find workflowExecuteThread, this check event will remove, processInstanceId:{}, taskCode:{}", processInstanceId, taskCode); taskInstanceTimeoutCheckList.remove(taskInstanceKey); continue; } Optional<TaskInstance> taskInstanceOptional = workflowExecuteThread.getActiveTaskInstanceByTaskCode(taskCode); if (!taskInstanceOptional.isPresent()) { logger.warn("can not find taskInstance from workflowExecuteThread, this check event will remove, processInstanceId:{}, taskCode:{}", processInstanceId, taskCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
taskInstanceTimeoutCheckList.remove(taskInstanceKey); continue; } TaskInstance taskInstance = taskInstanceOptional.get(); if (TimeoutFlag.OPEN == taskInstance.getTaskDefine().getTimeoutFlag()) { long timeRemain = DateUtils.getRemainTime(taskInstance.getStartTime(), (long) taskInstance.getTaskDefine().getTimeout() * Constants.SEC_2_MINUTES_TIME_UNIT); if (timeRemain < 0) { addTaskTimeoutEvent(taskInstance); taskInstanceTimeoutCheckList.remove(taskInstanceKey); } } } } private void checkTask4Retry() { if (taskInstanceRetryCheckList.isEmpty()) { return; } for (TaskInstanceKey taskInstanceKey : taskInstanceRetryCheckList) { int processInstanceId = taskInstanceKey.getProcessInstanceId(); long taskCode = taskInstanceKey.getTaskCode(); WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId); if (workflowExecuteThread == null) { logger.warn("can not find workflowExecuteThread, this check event will remove, processInstanceId:{}, taskCode:{}", processInstanceId, taskCode); taskInstanceRetryCheckList.remove(taskInstanceKey); continue; } Optional<TaskInstance> taskInstanceOptional = workflowExecuteThread.getRetryTaskInstanceByTaskCode(taskCode); ProcessInstance processInstance = workflowExecuteThread.getProcessInstance(); if (processInstance.getState() == ExecutionStatus.READY_STOP) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
addProcessStopEvent(processInstance); taskInstanceRetryCheckList.remove(taskInstanceKey); break; } if (!taskInstanceOptional.isPresent()) { logger.warn("can not find taskInstance from workflowExecuteThread, this check event will remove, processInstanceId:{}, taskCode:{}", processInstanceId, taskCode); taskInstanceRetryCheckList.remove(taskInstanceKey); continue; } TaskInstance taskInstance = taskInstanceOptional.get(); if (taskInstance.retryTaskIntervalOverTime()) { taskInstance.setEndTime(null); taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS); addTaskRetryEvent(taskInstance); taskInstanceRetryCheckList.remove(taskInstanceKey); } } } private void checkTask4State() { if (taskInstanceStateCheckList.isEmpty()) { return; } for (TaskInstanceKey taskInstanceKey : taskInstanceStateCheckList) { int processInstanceId = taskInstanceKey.getProcessInstanceId(); long taskCode = taskInstanceKey.getTaskCode(); WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId); if (workflowExecuteThread == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
logger.warn("can not find workflowExecuteThread, this check event will remove, processInstanceId:{}, taskCode:{}", processInstanceId, taskCode); taskInstanceStateCheckList.remove(taskInstanceKey); continue; } Optional<TaskInstance> taskInstanceOptional = workflowExecuteThread.getActiveTaskInstanceByTaskCode(taskCode); if (!taskInstanceOptional.isPresent()) { logger.warn("can not find taskInstance from workflowExecuteThread, this check event will remove, processInstanceId:{}, taskCode:{}", processInstanceId, taskCode); taskInstanceStateCheckList.remove(taskInstanceKey); continue; } TaskInstance taskInstance = taskInstanceOptional.get(); if (taskInstance.getState().typeIsFinished()) { continue; } addTaskStateChangeEvent(taskInstance); } } private void addTaskStateChangeEvent(TaskInstance taskInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId()); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setTaskCode(taskInstance.getTaskCode()); stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); workflowExecuteThreadPool.submitStateEvent(stateEvent); } private void addProcessStopEvent(ProcessInstance processInstance) { StateEvent stateEvent = new StateEvent();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,413
[Bug] [Master] If an exception occurs during startup, the log will be flushed in an infinite loop
### 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 If an exception occurs during startup, the log will be flushed in an infinite loop, Hundreds of megabytes of logs are generated instantly ![image](https://user-images.githubusercontent.com/20675095/173209845-c64c9255-3dbd-4a0f-ab75-5a73c9b82af4.png) ![image](https://user-images.githubusercontent.com/20675095/173211004-81661eda-7caf-42cb-8156-5b4764abd628.png) ### What you expected to happen Start abnormal interrupt procedures, easy to troubleshoot problems ### How to reproduce An exception is thrown when the load bean is started ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [ ] 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/10413
https://github.com/apache/dolphinscheduler/pull/10500
6e4b2e69927af70bccda5a2e70fe93d7b1a852e7
117f78ec4b0e2438082a3e25158492eca1b9b1be
2022-06-12T01:56:07Z
java
2022-06-20T14:35:06Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
stateEvent.setType(StateEventType.PROCESS_STATE_CHANGE); stateEvent.setProcessInstanceId(processInstance.getId()); stateEvent.setExecutionStatus(ExecutionStatus.STOP); workflowExecuteThreadPool.submitStateEvent(stateEvent); } private void addTaskRetryEvent(TaskInstance taskInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.TASK_RETRY); stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId()); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setTaskCode(taskInstance.getTaskCode()); stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); workflowExecuteThreadPool.submitStateEvent(stateEvent); } private void addTaskTimeoutEvent(TaskInstance taskInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.TASK_TIMEOUT); stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId()); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setTaskCode(taskInstance.getTaskCode()); workflowExecuteThreadPool.submitStateEvent(stateEvent); } private void addProcessTimeoutEvent(ProcessInstance processInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.PROCESS_TIMEOUT); stateEvent.setProcessInstanceId(processInstance.getId()); workflowExecuteThreadPool.submitStateEvent(stateEvent); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.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.server.master.dispatch.host;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.HeartBeat; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory; import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext; import org.apache.dolphinscheduler.server.master.dispatch.host.assign.HostWeight; import org.apache.dolphinscheduler.server.master.dispatch.host.assign.HostWorker; import org.apache.dolphinscheduler.server.master.dispatch.host.assign.LowerWeightRoundRobin; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections.CollectionUtils; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * lower weight host manager */ public class LowerWeightHostManager extends CommonHostManager {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java
private final Logger logger = LoggerFactory.getLogger(LowerWeightHostManager.class); /** * selector */ private LowerWeightRoundRobin selector; /** * worker host weights */ private ConcurrentHashMap<String, Set<HostWeight>> workerHostWeightsMap; /** * worker group host lock */ private Lock lock; /** * executor service */ private ScheduledExecutorService executorService; @PostConstruct public void init() { this.selector = new LowerWeightRoundRobin(); this.workerHostWeightsMap = new ConcurrentHashMap<>(); this.lock = new ReentrantLock(); this.executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LowerWeightHostManagerExecutor")); this.executorService.scheduleWithFixedDelay(new RefreshResourceTask(), 0, 1, TimeUnit.SECONDS); } @PreDestroy public void close() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java
this.executorService.shutdownNow(); } /** * select host * * @param context context * @return host */ @Override public Host select(ExecutionContext context) { Set<HostWeight> workerHostWeights = getWorkerHostWeights(context.getWorkerGroup()); if (CollectionUtils.isNotEmpty(workerHostWeights)) { return selector.select(workerHostWeights).getHost(); } return new Host(); } @Override public HostWorker select(Collection<HostWorker> nodes) { throw new UnsupportedOperationException("not support"); } private void syncWorkerHostWeight(Map<String, Set<HostWeight>> workerHostWeights) { lock.lock(); try { workerHostWeightsMap.clear(); workerHostWeightsMap.putAll(workerHostWeights); } finally { lock.unlock(); } } private Set<HostWeight> getWorkerHostWeights(String workerGroup) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java
lock.lock(); try { return workerHostWeightsMap.get(workerGroup); } finally { lock.unlock(); } } class RefreshResourceTask implements Runnable { @Override public void run() { try { Map<String, Set<HostWeight>> workerHostWeights = new HashMap<>(); Map<String, Set<String>> workerGroupNodes = serverNodeManager.getWorkerGroupNodes(); for (Map.Entry<String, Set<String>> entry : workerGroupNodes.entrySet()) { String workerGroup = entry.getKey(); Set<String> nodes = entry.getValue(); Set<HostWeight> hostWeights = new HashSet<>(nodes.size()); for (String node : nodes) { String heartbeat = serverNodeManager.getWorkerNodeInfo(node); Optional<HostWeight> hostWeightOpt = getHostWeight(node, workerGroup, heartbeat); if (hostWeightOpt.isPresent()) { hostWeights.add(hostWeightOpt.get()); } } if (!hostWeights.isEmpty()) { workerHostWeights.put(workerGroup, hostWeights); } } syncWorkerHostWeight(workerHostWeights); } catch (Throwable ex) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java
logger.error("RefreshResourceTask error", ex); } } public Optional<HostWeight> getHostWeight(String addr, String workerGroup, String heartBeatInfo) { if (StringUtils.isEmpty(heartBeatInfo)) { logger.warn("worker {} in work group {} have not received the heartbeat", addr, workerGroup); return Optional.empty(); } HeartBeat heartBeat = HeartBeat.decodeHeartBeat(heartBeatInfo); if (heartBeat == null) { return Optional.empty(); } if (Constants.ABNORMAL_NODE_STATUS == heartBeat.getServerStatus()) { logger.warn("worker {} current cpu load average {} is too high or available memory {}G is too low", addr, heartBeat.getLoadAverage(), heartBeat.getAvailablePhysicalMemorySize()); return Optional.empty(); } if (Constants.BUSY_NODE_STATUE == heartBeat.getServerStatus()) { logger.warn("worker {} is busy, current waiting task count {} is large than worker thread count {}", addr, heartBeat.getWorkerWaitingTaskCount(), heartBeat.getWorkerExecThreadCount()); return Optional.empty(); } return Optional.of( new HostWeight(HostWorker.of(addr, heartBeat.getWorkerHostWeight(), workerGroup), heartBeat.getCpuUsage(), heartBeat.getMemoryUsage(), heartBeat.getLoadAverage(), heartBeat.getWorkerWaitingTaskCount(), heartBeat.getStartupTime())); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.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.server.master.registry; import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS; import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper; import org.apache.dolphinscheduler.registry.api.Event; import org.apache.dolphinscheduler.registry.api.Event.Type;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
import org.apache.dolphinscheduler.registry.api.SubscribeListener; import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.service.queue.MasterPriorityQueue; import org.apache.dolphinscheduler.service.registry.RegistryClient; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * server node manager */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
public class ServerNodeManager implements InitializingBean { private final Logger logger = LoggerFactory.getLogger(ServerNodeManager.class); /** * master lock */ private final Lock masterLock = new ReentrantLock(); /** * worker group lock */ private final Lock workerGroupLock = new ReentrantLock(); /** * worker node info lock */ private final Lock workerNodeInfoLock = new ReentrantLock(); /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
* worker group nodes */ private final ConcurrentHashMap<String, Set<String>> workerGroupNodes = new ConcurrentHashMap<>(); /** * master nodes */ private final Set<String> masterNodes = new HashSet<>(); /** * worker node info */ private final Map<String, String> workerNodeInfo = new HashMap<>(); /** * executor service */ private ScheduledExecutorService executorService; @Autowired private RegistryClient registryClient; /** * eg : /node/worker/group/127.0.0.1:xxx */ private static final int WORKER_LISTENER_CHECK_LENGTH = 5; /** * worker group mapper */ @Autowired private WorkerGroupMapper workerGroupMapper; private final MasterPriorityQueue masterPriorityQueue = new MasterPriorityQueue(); /** * alert dao */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Autowired private AlertDao alertDao; /** * master config */ @Autowired private MasterConfig masterConfig; private static volatile int MASTER_SLOT = 0; private static volatile int MASTER_SIZE = 0; public static int getSlot() { return MASTER_SLOT; } public static int getMasterSize() { return MASTER_SIZE; } /** * init listener * * @throws Exception if error throws Exception */ @Override public void afterPropertiesSet() throws Exception { /** * load nodes from zookeeper */ load(); /** * init executor service */ executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("ServerNodeManagerExecutor"));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
executorService.scheduleWithFixedDelay(new WorkerNodeInfoAndGroupDbSyncTask(), 0, 10, TimeUnit.SECONDS); /* * init MasterNodeListener listener */ registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_MASTERS, new MasterDataListener()); /* * init WorkerNodeListener listener */ registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_WORKERS, new WorkerDataListener()); } /** * load nodes from zookeeper */ public void load() { /* * master nodes from zookeeper */ updateMasterNodes(); /* * worker group nodes from zookeeper */ Collection<String> workerGroups = registryClient.getWorkerGroupDirectly(); for (String workerGroup : workerGroups) { syncWorkerGroupNodes(workerGroup, registryClient.getWorkerGroupNodesDirectly(workerGroup)); } } /** * worker node info and worker group db sync task */ class WorkerNodeInfoAndGroupDbSyncTask implements Runnable {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void run() { try { Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true); syncAllWorkerNodeInfo(newWorkerNodeInfo); List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup(); if (CollectionUtils.isNotEmpty(workerGroupList)) { for (WorkerGroup wg : workerGroupList) { String workerGroup = wg.getName(); Set<String> nodes = new HashSet<>(); String[] addrs = wg.getAddrList().split(Constants.COMMA); for (String addr : addrs) { if (newWorkerNodeInfo.containsKey(addr)) { nodes.add(addr); } } if (!nodes.isEmpty()) { syncWorkerGroupNodes(workerGroup, nodes); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} } catch (Exception e) { logger.error("WorkerNodeInfoAndGroupDbSyncTask error:", e); } } } /** * worker group node listener */ class WorkerDataListener implements SubscribeListener { @Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); final String data = event.data(); if (registryClient.isWorkerPath(path)) { try { if (type == Type.ADD) { logger.info("worker group node : {} added.", path); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); logger.info("currentNodes : {}", currentNodes); syncWorkerGroupNodes(group, currentNodes); } else if (type == Type.REMOVE) { logger.info("worker group node : {} down.", path); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); alertDao.sendServerStoppedAlert(1, path, "WORKER"); } else if (type == Type.UPDATE) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
logger.debug("worker group node : {} update, data: {}", path, data); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); String node = parseNode(path); syncSingleWorkerNodeInfo(node, data); } } catch (IllegalArgumentException ex) { logger.warn(ex.getMessage()); } catch (Exception ex) { logger.error("WorkerGroupListener capture data change and get data failed", ex); } } } private String parseGroup(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 2]; } private String parseNode(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 1]; } } class MasterDataListener implements SubscribeListener {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); if (registryClient.isMasterPath(path)) { try { if (type.equals(Type.ADD)) { logger.info("master node : {} added.", path); updateMasterNodes(); } if (type.equals(Type.REMOVE)) { logger.info("master node : {} down.", path); updateMasterNodes(); alertDao.sendServerStoppedAlert(1, path, "MASTER"); } } catch (Exception ex) { logger.error("MasterNodeListener capture data change and get data failed.", ex); } } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
private void updateMasterNodes() { MASTER_SLOT = 0; MASTER_SIZE = 0; this.masterNodes.clear(); String nodeLock = Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS; try { registryClient.getLock(nodeLock); Collection<String> currentNodes = registryClient.getMasterNodesDirectly(); List<Server> masterNodes = registryClient.getServerList(NodeType.MASTER); syncMasterNodes(currentNodes, masterNodes); } catch (Exception e) { logger.error("update master nodes error", e); } finally { registryClient.releaseLock(nodeLock); } } /** * get master nodes * * @return master nodes */ public Set<String> getMasterNodes() { masterLock.lock(); try { return Collections.unmodifiableSet(masterNodes); } finally { masterLock.unlock(); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
* sync master nodes * * @param nodes master nodes */ private void syncMasterNodes(Collection<String> nodes, List<Server> masterNodes) { masterLock.lock(); try { String addr = NetUtils.getAddr(NetUtils.getHost(), masterConfig.getListenPort()); this.masterNodes.addAll(nodes); this.masterPriorityQueue.clear(); this.masterPriorityQueue.putList(masterNodes); int index = masterPriorityQueue.getIndex(addr); if (index >= 0) { MASTER_SIZE = nodes.size(); MASTER_SLOT = index; } else { logger.warn("current addr:{} is not in active master list", addr); } logger.info("update master nodes, master size: {}, slot: {}, addr: {}", MASTER_SIZE, MASTER_SLOT, addr); } finally { masterLock.unlock(); } } /** * sync worker group nodes * * @param workerGroup worker group * @param nodes worker nodes */ private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
workerGroupLock.lock(); try { Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } public Map<String, Set<String>> getWorkerGroupNodes() { return Collections.unmodifiableMap(workerGroupNodes); } /** * get worker group nodes * * @param workerGroup workerGroup * @return worker nodes */ public Set<String> getWorkerGroupNodes(String workerGroup) { workerGroupLock.lock(); try { if (StringUtils.isEmpty(workerGroup)) { workerGroup = Constants.DEFAULT_WORKER_GROUP; } Set<String> nodes = workerGroupNodes.get(workerGroup); if (CollectionUtils.isNotEmpty(nodes)) { return Collections.unmodifiableSet(nodes); } return nodes;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} finally { workerGroupLock.unlock(); } } /** * get worker node info * * @return worker node info */ public Map<String, String> getWorkerNodeInfo() { return Collections.unmodifiableMap(workerNodeInfo); } /** * get worker node info * * @param workerNode worker node * @return worker node info */ public String getWorkerNodeInfo(String workerNode) { workerNodeInfoLock.lock(); try { return workerNodeInfo.getOrDefault(workerNode, null); } finally { workerNodeInfoLock.unlock(); } } /** * sync worker node info * * @param newWorkerNodeInfo new worker node info
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,309
[Improvement][Master] Remove the schedule thread in LowerWeightHostManager
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When we use LOWER_WEIGHT strategy to dispatch the task, the master will use a schedule thread to sync the worker's info from ServerNodeManager, see code in LowerWeightHostManager. It's better to use notification rather than schedule pooling, this can reduce the invalid looping. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a 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/10309
https://github.com/apache/dolphinscheduler/pull/10310
36e20cdfc8d668b56ab60e273a7327ca41c57a04
b100f6c4890fb8db8887e24891c6af963c582360
2022-05-31T08:27:41Z
java
2022-06-21T05:30:07Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
*/ private void syncAllWorkerNodeInfo(Map<String, String> newWorkerNodeInfo) { workerNodeInfoLock.lock(); try { workerNodeInfo.clear(); workerNodeInfo.putAll(newWorkerNodeInfo); } finally { workerNodeInfoLock.unlock(); } } /** * sync single worker node info */ private void syncSingleWorkerNodeInfo(String node, String info) { workerNodeInfoLock.lock(); try { workerNodeInfo.put(node, info); } finally { workerNodeInfoLock.unlock(); } } /** * destroy */ @PreDestroy public void destroy() { executorService.shutdownNow(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.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.service.corn; import com.cronutils.model.Cron; import com.cronutils.model.definition.CronDefinitionBuilder; import com.cronutils.parser.CronParser; import org.apache.commons.collections.CollectionUtils; import org.apache.dolphinscheduler.common.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
import org.apache.dolphinscheduler.common.enums.CycleEnum; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.quartz.CronExpression; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.Map; import static com.cronutils.model.CronType.QUARTZ; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST; import static org.apache.dolphinscheduler.common.Constants.COMMA; import static org.apache.dolphinscheduler.service.corn.CycleFactory.day; import static org.apache.dolphinscheduler.service.corn.CycleFactory.hour; import static org.apache.dolphinscheduler.service.corn.CycleFactory.min; import static org.apache.dolphinscheduler.service.corn.CycleFactory.month; import static org.apache.dolphinscheduler.service.corn.CycleFactory.week; import static org.apache.dolphinscheduler.service.corn.CycleFactory.year; /** * // todo: this utils is heavy, it rely on quartz and corn-utils. * cron utils */ public class CronUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
private CronUtils() { throw new IllegalStateException("CronUtils class"); } private static final Logger logger = LoggerFactory.getLogger(CronUtils.class); private static final CronParser QUARTZ_CRON_PARSER = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(QUARTZ)); /** * parse to cron * * @param cronExpression cron expression, never null * @return Cron instance, corresponding to cron expression received */ public static Cron parse2Cron(String cronExpression) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
return QUARTZ_CRON_PARSER.parse(cronExpression); } /** * build a new CronExpression based on the string cronExpression * * @param cronExpression String representation of the cron expression the new object should represent * @return CronExpression * @throws ParseException if the string expression cannot be parsed into a valid */ public static CronExpression parse2CronExpression(String cronExpression) throws ParseException { return new CronExpression(cronExpression); } /** * get max cycle * * @param cron cron * @return CycleEnum */ public static CycleEnum getMaxCycle(Cron cron) { return min(cron).addCycle(hour(cron)).addCycle(day(cron)).addCycle(week(cron)).addCycle(month(cron)).addCycle(year(cron)).getCycle(); } /** * get min cycle * * @param cron cron * @return CycleEnum */ public static CycleEnum getMiniCycle(Cron cron) { return min(cron).addCycle(hour(cron)).addCycle(day(cron)).addCycle(week(cron)).addCycle(month(cron)).addCycle(year(cron)).getMiniCycle(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
/** * get max cycle * * @param crontab crontab * @return CycleEnum */ public static CycleEnum getMaxCycle(String crontab) { return getMaxCycle(parse2Cron(crontab)); } /** * gets all scheduled times for a period of time based on not self dependency * * @param startTime startTime * @param endTime endTime * @param cronExpression cronExpression * @return date list */ public static List<Date> getFireDateList(Date startTime, Date endTime, CronExpression cronExpression) { List<Date> dateList = new ArrayList<>(); while (Stopper.isRunning()) { startTime = cronExpression.getNextValidTimeAfter(startTime); if (startTime.after(endTime)) { break; } dateList.add(startTime); } return dateList; } /** * gets expect scheduled times for a period of time based on self dependency
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
* * @param startTime startTime * @param endTime endTime * @param cronExpression cronExpression * @param fireTimes fireTimes * @return date list */ public static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression, int fireTimes) { List<Date> dateList = new ArrayList<>(); while (fireTimes > 0) { startTime = cronExpression.getNextValidTimeAfter(startTime); if (startTime.after(endTime) || startTime.equals(endTime)) { break; } dateList.add(startTime); fireTimes--; } return dateList; } /** * gets all scheduled times for a period of time based on self dependency * * @param startTime startTime * @param endTime endTime * @param cronExpression cronExpression * @return date list */ public static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression) { List<Date> dateList = new ArrayList<>(); while (Stopper.isRunning()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
startTime = cronExpression.getNextValidTimeAfter(startTime); if (startTime.after(endTime) || startTime.equals(endTime)) { break; } dateList.add(startTime); } return dateList; } /** * gets all scheduled times for a period of time based on self dependency * if schedulers is empty then default scheduler = 1 day */ public static List<Date> getSelfFireDateList(final Date startTime, final Date endTime, final List<Schedule> schedules) { List<Date> result = new ArrayList<>(); if (startTime.equals(endTime)) { result.add(startTime); return result; } Date from = new Date(startTime.getTime() - Constants.SECOND_TIME_MILLIS); Date to = new Date(endTime.getTime() + Constants.SECOND_TIME_MILLIS); List<Schedule> listSchedule = new ArrayList<>(); listSchedule.addAll(schedules); if (CollectionUtils.isEmpty(listSchedule)) { Schedule schedule = new Schedule(); schedule.setCrontab(Constants.DEFAULT_CRON_STRING); listSchedule.add(schedule); } for (Schedule schedule : listSchedule) { result.addAll(CronUtils.getSelfFireDateList(from, to, schedule.getCrontab()));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
} return result; } /** * gets all scheduled times for a period of time based on self dependency * * @param startTime startTime * @param endTime endTime * @param cron cron * @return date list */ public static List<Date> getSelfFireDateList(Date startTime, Date endTime, String cron) { CronExpression cronExpression = null; try { cronExpression = parse2CronExpression(cron); } catch (ParseException e) { logger.error(e.getMessage(), e); return Collections.emptyList(); } return getSelfFireDateList(startTime, endTime, cronExpression); } /** * get expiration time * * @param startTime startTime * @param cycleEnum cycleEnum * @return date */ public static Date getExpirationTime(Date startTime, CycleEnum cycleEnum) { Date maxExpirationTime = null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
Date startTimeMax = null; try { startTimeMax = getEndTime(startTime); Calendar calendar = Calendar.getInstance(); calendar.setTime(startTime); switch (cycleEnum) { case HOUR: calendar.add(Calendar.HOUR, 1); break; case DAY: calendar.add(Calendar.DATE, 1); break; case WEEK: calendar.add(Calendar.DATE, 1); break; case MONTH: calendar.add(Calendar.DATE, 1); break; default: logger.error("Dependent process definition's cycleEnum is {},not support!!", cycleEnum); break; } maxExpirationTime = calendar.getTime(); } catch (Exception e) { logger.error(e.getMessage(), e); } return DateUtils.compare(startTimeMax, maxExpirationTime) ? maxExpirationTime : startTimeMax; } /** * get the end time of the day by value of date
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,522
[Bug] [API] Get executable time null pointer exception
### 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 Get executable time null pointer exception cron: `0 0 4 7 7 ? 2022` ``` java.lang.NullPointerException at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:175) at org.apache.dolphinscheduler.service.quartz.cron.CronUtils.getSelfFireDateList(CronUtils.java:228) at org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest.getExpirationTime1(CronUtilsTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ``` ### What you expected to happen fix NullPointerException ### How to reproduce Set timing `0 0 4 7 7 ? 2022`, get execution time ![image](https://user-images.githubusercontent.com/37063904/174718333-5a9f209d-7bea-4c1c-a70b-95fd90b82c17.png) ### 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/10522
https://github.com/apache/dolphinscheduler/pull/10523
bf077cb38f34a7ea427caca0e7125e9128ec4795
cefcb6d5562e899db7508970bd5fdc7f72c3e23f
2022-06-21T04:50:09Z
java
2022-06-22T00:58:19Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/corn/CronUtils.java
* * @return date */ private static Date getEndTime(Date date) { Calendar end = new GregorianCalendar(); end.setTime(date); end.set(Calendar.HOUR_OF_DAY, 23); end.set(Calendar.MINUTE, 59); end.set(Calendar.SECOND, 59); end.set(Calendar.MILLISECOND, 999); return end.getTime(); } /** * get Schedule Date * @param param * @return date list */ public static List<Date> getSelfScheduleDateList(Map<String, String> param){ List<Date> result = new ArrayList<>(); String scheduleDates = param.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST); if(StringUtils.isNotEmpty(scheduleDates)){ for (String stringDate : scheduleDates.split(COMMA)) { result.add(DateUtils.stringToDate(stringDate)); } return result; } return null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* 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 com.fasterxml.jackson.core.type.TypeReference; import com.google.common.collect.Lists; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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.Command; import org.apache.dolphinscheduler.dao.entity.DependentProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; 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.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.StateEventChangeCommand;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
import org.apache.dolphinscheduler.remote.processor.StateEventCallbackService; import org.apache.dolphinscheduler.service.corn.CronUtils; import org.apache.dolphinscheduler.service.process.ProcessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_START; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST; 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.COMMA; import static org.apache.dolphinscheduler.common.Constants.MAX_TASK_TIMEOUT; import static org.apache.dolphinscheduler.common.Constants.SCHEDULE_TIME_MAX_LENGTH; /** * executor service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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 private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private TaskGroupQueueMapper taskGroupQueueMapper; /** * execute process instance * * @param loginUser login user * @param projectCode project code * @param processDefinitionCode process definition code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @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, 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, WORKFLOW_START); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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(!checkScheduleTimeNum(commandType,cronTime)){ putMsg(result, Status.SCHEDULE_TIME_NUMBER); return result; } if (!checkMasterExists(result)) { return result; } /** * create command */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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); return false; } return true; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* * @param complementData * @param cronTime * @return CommandType is COMPLEMENT_DATA and cronTime's number is not greater than 100 return true , otherwise return false */ private boolean checkScheduleTimeNum(CommandType complementData,String cronTime) { if (!CommandType.COMPLEMENT_DATA.equals(complementData)) { return true; } if(cronTime == null){ return true; } Map<String,String> cronMap = JSONUtils.toMap(cronTime); if (cronMap.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) { String[] stringDates = cronMap.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST).split(COMMA); if (stringDates.length > SCHEDULE_TIME_MAX_LENGTH) { 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 */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
@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; } /** * 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());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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 * @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, ApiFuncIdentificationConstant.map.get(executeType)); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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; } } 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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) { 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:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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; } 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(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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: 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; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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; } /** * 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
// 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 * * @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()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
,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<>(); // 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)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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 */ @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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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; } /** * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @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) { 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} 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()); } command.setProcessInstanceId(0); // if (commandType == CommandType.COMPLEMENT_DATA) { if (schedule == null || StringUtils.isEmpty(schedule)) { return 0; } int check = checkScheduleTime(schedule); if(check == 0){ return 0; } return createComplementCommandList(schedule, runMode, command, expectedParallelismNumber, complementDependentMode); } else {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
command.setCommandParam(JSONUtils.toJsonString(cmdParam)); return processService.createCommand(command); } } /** * create complement command * close left and close right * * @param scheduleTimeParam * @param runMode * @return */ protected int createComplementCommandList(String scheduleTimeParam, RunMode runMode, Command command, Integer expectedParallelismNumber, ComplementDependentMode complementDependentMode) { int createCount = 0; String startDate = null; String endDate = null; String dateList = null; int dependentProcessDefinitionCreateCount = 0; runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode; Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam()); Map<String, String> scheduleParam = JSONUtils.toMap(scheduleTimeParam); if(scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)){ dateList = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST); dateList = removeDuplicates(dateList); } if(scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE) && scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_END_DATE)){ startDate = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); endDate = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
switch (runMode) { case RUN_MODE_SERIAL: { if(StringUtils.isNotEmpty(dateList)){ cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST, dateList); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); createCount = processService.createCommand(command); } if(startDate != null && endDate != null){ cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startDate); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endDate); 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); } } break; } case RUN_MODE_PARALLEL: { if(startDate != null && endDate != null){ List<Date> listDate = new ArrayList<>(); List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode(command.getProcessDefinitionCode()); listDate.addAll(CronUtils.getSelfFireDateList(DateUtils.getScheduleDate(startDate), DateUtils.getScheduleDate(endDate), schedules)); int listDateSize = listDate.size(); createCount = listDate.size();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
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; 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());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} else { dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); } } } } if(StringUtils.isNotEmpty(dateList)){ List<String> listDate = Arrays.asList(dateList.split(COMMA)); 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); for (List<String> stringDate : Lists.partition(listDate, createCount)) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST, String.join(COMMA, stringDate)); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); processService.createCommand(command); } } } break; } default: break; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
logger.info("create complement command count: {}, create dependent complement command count: {}", createCount , dependentProcessDefinitionCreateCount); return createCount; } /** * create complement dependent command */ 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} /** * get complement list */ private List<DependentProcessDefinition> getComplementDependentDefinitionList(long processDefinitionCode, CycleEnum processDefinitionCycle, 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} } return validDependentProcessDefinitionList; } /** * * @param schedule * @return check error return 0 otherwish 1 */ private int checkScheduleTime(String schedule){ Date start = null; Date end = null; Map<String,String> scheduleResult = JSONUtils.toMap(schedule); if(scheduleResult == null){ return 0; } if(scheduleResult.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)){ if(scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST) == null){ return 0; } } if(scheduleResult.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)){ String startDate = scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); String endDate = scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); if (startDate == null || endDate == null) { return 0; } start = DateUtils.getScheduleDate(startDate); end = DateUtils.getScheduleDate(endDate); if(start == null || end == null){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return 0; } if (start.after(end)) { logger.error("complement data error, wrong date start:{} and end date:{} ", start, end ); return 0; } } return 1; } /** * * @param scheduleTimeList * @return remove duplicate date list */ private String removeDuplicates(String scheduleTimeList){ HashSet<String> removeDate = new HashSet<String>(); List<String> resultList = new ArrayList<String>(); if(StringUtils.isNotEmpty(scheduleTimeList)){ String[] dateArrays = scheduleTimeList.split(COMMA); List<String> dateList = Arrays.asList(dateArrays); removeDate.addAll(dateList); resultList.addAll(removeDate); return String.join(COMMA, resultList); } return null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
/* * Lcensed to the Apache Software Foundaton (ASF) under one or more * contrbutor lcense agreements. See the NOTICE fle dstrbuted wth * ths work for addtonal nformaton regardng copyrght ownershp. * The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0 * (the "Lcense"); you may not use ths fle except n complance wth * the Lcense. You may obtan a copy of the Lcense at * * http://www.apache.org/lcenses/LICENSE-2.0 * * Unless requred by applcable law or agreed to n wrtng, software * dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
* See the Lcense for the specfc language governng permssons and * lmtatons under the Lcense. */ package org.apache.dolphnscheduler.server.master.runner; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES; mport statc org.apache.dolphnscheduler.common.Constants.COMMA; mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP; mport statc org.apache.dolphnscheduler.common.Constants.YYYY_MM_DD_HH_MM_SS; mport statc org.apache.dolphnscheduler.plugn.task.ap.TaskConstants.TASK_TYPE_BLOCKING; mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.DataType.VARCHAR; mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.Drect.IN; mport org.apache.dolphnscheduler.common.Constants; mport org.apache.dolphnscheduler.common.enums.CommandType; mport org.apache.dolphnscheduler.common.enums.FalureStrategy; mport org.apache.dolphnscheduler.common.enums.Flag; mport org.apache.dolphnscheduler.common.enums.Prorty; mport org.apache.dolphnscheduler.common.enums.StateEvent; mport org.apache.dolphnscheduler.common.enums.StateEventType; mport org.apache.dolphnscheduler.common.enums.TaskDependType; mport org.apache.dolphnscheduler.common.enums.TaskGroupQueueStatus; mport org.apache.dolphnscheduler.common.enums.TmeoutFlag; mport org.apache.dolphnscheduler.common.graph.DAG; mport org.apache.dolphnscheduler.common.model.TaskNode; mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton; mport org.apache.dolphnscheduler.common.process.ProcessDag;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
mport org.apache.dolphnscheduler.common.utls.DateUtls; mport org.apache.dolphnscheduler.common.utls.JSONUtls; mport org.apache.dolphnscheduler.common.utls.NetUtls; mport org.apache.dolphnscheduler.common.utls.ParameterUtls; mport org.apache.dolphnscheduler.dao.entty.Command; mport org.apache.dolphnscheduler.dao.entty.Envronment; mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton; mport org.apache.dolphnscheduler.dao.entty.ProcessInstance; mport org.apache.dolphnscheduler.dao.entty.ProcessTaskRelaton; mport org.apache.dolphnscheduler.dao.entty.ProjectUser; mport org.apache.dolphnscheduler.dao.entty.Schedule; mport org.apache.dolphnscheduler.dao.entty.TaskDefntonLog; mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue; mport org.apache.dolphnscheduler.dao.entty.TaskInstance; mport org.apache.dolphnscheduler.dao.utls.DagHelper; mport org.apache.dolphnscheduler.plugn.task.ap.enums.DependResult; mport org.apache.dolphnscheduler.plugn.task.ap.enums.Drect; mport org.apache.dolphnscheduler.plugn.task.ap.enums.ExecutonStatus; mport org.apache.dolphnscheduler.plugn.task.ap.enums.TaskTmeoutStrategy; mport org.apache.dolphnscheduler.plugn.task.ap.model.Property; mport org.apache.dolphnscheduler.plugn.task.ap.parameters.BlockngParameters; mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand; mport org.apache.dolphnscheduler.remote.utls.Host; mport org.apache.dolphnscheduler.server.master.confg.MasterConfg; mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager; mport org.apache.dolphnscheduler.server.master.metrcs.ProcessInstanceMetrcs; mport org.apache.dolphnscheduler.server.master.metrcs.TaskMetrcs; mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor; mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon; mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager; mport org.apache.dolphnscheduler.servce.corn.CronUtls; mport org.apache.dolphnscheduler.servce.process.ProcessServce; mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue; mport org.apache.commons.collectons.CollectonUtls; mport org.apache.commons.lang3.StrngUtls; mport org.apache.commons.lang3.math.NumberUtls; mport java.utl.ArrayLst; mport java.utl.Arrays; mport java.utl.Collecton; mport java.utl.Date; mport java.utl.HashMap; mport java.utl.HashSet; mport java.utl.Iterator; mport java.utl.Lst; mport java.utl.Map; mport java.utl.Objects; mport java.utl.Optonal; mport java.utl.Set; mport java.utl.concurrent.ConcurrentHashMap; mport java.utl.concurrent.ConcurrentLnkedQueue; mport java.utl.concurrent.atomc.AtomcBoolean; mport org.slf4j.Logger; mport org.slf4j.LoggerFactory; mport com.google.common.collect.Lsts; /** * Workflow execute task, used to execute a workflow nstance. */ publc class WorkflowExecuteRunnable mplements Runnable { /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
* logger of WorkflowExecuteThread */ prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteRunnable.class); /** * master confg */ prvate fnal MasterConfg masterConfg; /** * process servce */ prvate fnal ProcessServce processServce; /** * alert manager */ prvate fnal ProcessAlertManager processAlertManager; /** * netty executor manager */ prvate fnal NettyExecutorManager nettyExecutorManager; /** * process nstance */ prvate ProcessInstance processInstance; /** * process defnton */ prvate ProcessDefnton processDefnton; /** * the object of DAG */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag; /** * key of workflow */ prvate Strng key; /** * start flag, true: start nodes submt completely */ prvate boolean sStart = false; /** * submt falure nodes */ prvate boolean taskFaledSubmt = false; /** * task nstance hash map, taskId as key */ prvate fnal Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>(); /** * runnng taskProcessor, taskCode as key, taskProcessor as value * only on taskProcessor per taskCode */ prvate fnal Map<Long, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>(); /** * vald task map, taskCode as key, taskId as value * n a DAG, only one taskInstance per taskCode s vald */ prvate fnal Map<Long, Integer> valdTaskMap = new ConcurrentHashMap<>(); /** * error task map, taskCode as key, taskInstanceId as value * n a DAG, only one taskInstance per taskCode s vald
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
*/ prvate fnal Map<Long, Integer> errorTaskMap = new ConcurrentHashMap<>(); /** * complete task map, taskCode as key, taskInstanceId as value * n a DAG, only one taskInstance per taskCode s vald */ prvate fnal Map<Long, Integer> completeTaskMap = new ConcurrentHashMap<>(); /** * depend faled task map, taskCode as key, taskId as value */ prvate fnal Map<Long, Integer> dependFaledTaskMap = new ConcurrentHashMap<>(); /** * forbdden task map, code as key */ prvate fnal Map<Long, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>(); /** * skp task map, code as key */ prvate fnal Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>(); /** * complement date lst */ prvate Lst<Date> complementLstDate = Lsts.newLnkedLst(); /** * state event queue */ prvate fnal ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>(); /** * ready to submt task queue */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
prvate fnal PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue(); /** * wat to retry taskInstance map, taskCode as key, taskInstance as value * before retry, the taskInstance d s 0 */ prvate fnal Map<Long, TaskInstance> watToRetryTaskInstanceMap = new ConcurrentHashMap<>(); /** * state wheel execute thread */ prvate fnal StateWheelExecuteThread stateWheelExecuteThread; /** * @param processInstance processInstance * @param processServce processServce * @param nettyExecutorManager nettyExecutorManager * @param processAlertManager processAlertManager * @param masterConfg masterConfg * @param stateWheelExecuteThread stateWheelExecuteThread */ publc WorkflowExecuteRunnable(ProcessInstance processInstance , ProcessServce processServce , NettyExecutorManager nettyExecutorManager , ProcessAlertManager processAlertManager , MasterConfg masterConfg , StateWheelExecuteThread stateWheelExecuteThread) { ths.processServce = processServce; ths.processInstance = processInstance; ths.masterConfg = masterConfg; ths.nettyExecutorManager = nettyExecutorManager; ths.processAlertManager = processAlertManager; ths.stateWheelExecuteThread = stateWheelExecuteThread;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
TaskMetrcs.regsterTaskPrepared(readyToSubmtTaskQueue::sze); } /** * the process start nodes are submtted completely. */ publc boolean sStart() { return ths.sStart; } /** * handle event */ publc vod handleEvents() { f (!sStart) { return; } whle (!ths.stateEvents.sEmpty()) { try { StateEvent stateEvent = ths.stateEvents.peek(); f (stateEventHandler(stateEvent)) { ths.stateEvents.remove(stateEvent); } } catch (Excepton e) { logger.error("state handle error:", e); } } } publc Strng getKey() { f (StrngUtls.sNotEmpty(key) || ths.processDefnton == null) { return key;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
} key = Strng.format("%d_%d_%d", ths.processDefnton.getCode(), ths.processDefnton.getVerson(), ths.processInstance.getId()); return key; } publc boolean addStateEvent(StateEvent stateEvent) { f (processInstance.getId() != stateEvent.getProcessInstanceId()) { logger.nfo("state event would be abounded :{}", stateEvent); return false; } ths.stateEvents.add(stateEvent); return true; } publc nt eventSze() { return ths.stateEvents.sze(); } publc ProcessInstance getProcessInstance() { return ths.processInstance; } prvate boolean stateEventHandler(StateEvent stateEvent) { logger.nfo("process event: {}", stateEvent); f (!checkProcessInstance(stateEvent)) { return false; } boolean result = false; swtch (stateEvent.getType()) { case PROCESS_STATE_CHANGE: measureProcessState(stateEvent);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
result = pr break; case TASK_STATE_CHANGE: measureTaskState(stateEvent); result = taskStateChangeHandler(stateEvent); break; case PROCESS_TIMEOUT: ProcessInstanceMetrcs.ncProcessInstanceTmeout(); result = processTmeout(); break; case TASK_TIMEOUT: TaskMetrcs.ncTaskTmeout(); result = taskTmeout(stateEvent); break; case WAIT_TASK_GROUP: result = checkForceStartAndWakeUp(stateEvent); break; case TASK_RETRY: TaskMetrcs.ncTaskRetry(); result = taskRetryEventHandler(stateEvent); break; case PROCESS_BLOCKED: result = processBlockHandler(stateEvent); break; default: break; } f (result) { ths.stateEvents.remove(stateEvent); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
return result; } prvate boolean checkForceStartAndWakeUp(StateEvent stateEvent) { TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId()); f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) { TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode()); taskProcessor.acton(TaskActon.DISPATCH); ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getTaskId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()); return true; } f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) { boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue); f (acqureTaskGroup) { TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode()); taskProcessor.acton(TaskActon.DISPATCH); return true; } } return false; } prvate boolean taskTmeout(StateEvent stateEvent) { f (!checkTaskInstanceByStateEvent(stateEvent)) { return true; } TaskInstance taskInstance = taskInstanceMap.get(stateEvent.getTaskInstanceId()); f (TmeoutFlag.CLOSE == taskInstance.getTaskDefne().getTmeoutFlag()) { return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
TaskTmeoutStrategy taskTmeoutStrategy = taskInstance.getTaskDefne().getTmeoutNotfyStrategy(); f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy || TaskTmeoutStrategy.WARNFAILED == taskTmeoutStrategy) { ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode()); 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; } Optonal<TaskInstance> taskInstanceOptonal = getTaskInstance(stateEvent.getTaskInstanceId()); TaskInstance task = taskInstanceOptonal.orElseThrow( () -> new RuntmeExcepton("Cannot fnd task nstance by task nstance d: " + 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
} taskFnshed(task); f (task.getTaskGroupId() > 0) { releaseTaskGroup(task); } 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
stateWheelExecuteThread.removeTask4StateCheck(processInstance, taskInstance); f (taskInstance.getState().typeIsSuccess()) { completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); processInstance.setVarPool(taskInstance.getVarPool()); processServce.saveProcessInstance(processInstance); 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
* * @param taskInstance */ prvate vod releaseTaskGroup(TaskInstance taskInstance) { f (taskInstance.getTaskGroupId() > 0) { 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; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
TaskInstance newTaskInstance = cloneRetryTaskInstance(taskInstance); f (newTaskInstance == null) { logger.error("retry fal, new taskInstancce s null, task code:{}, task d:{}", taskInstance.getTaskCode(), taskInstance.getId()); return; } 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());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
addTaskToStandByLst(taskInstance); submtStandByTask(); watToRetryTaskInstanceMap.remove(stateEvent.getTaskCode()); return true; } /** * 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());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
} } /** * check process nstance by state event */ 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
*/ publc boolean checkTaskInstanceByCode(long taskCode) { f (taskInstanceMap == null || taskInstanceMap.sze() == 0) { return false; } 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 Optonal<TaskInstance> getTaskInstance(nt taskInstanceId) { f (taskInstanceMap.contansKey(taskInstanceId)) { return Optonal.ofNullable(taskInstanceMap.get(taskInstanceId)); } return Optonal.empty(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
publc Optonal<TaskInstance> getTaskInstance(long taskCode) { f (taskInstanceMap.sEmpty()) { return Optonal.empty(); } for (TaskInstance taskInstance : taskInstanceMap.values()) { f (taskInstance.getTaskCode() == taskCode) { return Optonal.of(taskInstance); } } return Optonal.empty(); } publc Optonal<TaskInstance> getActveTaskInstanceByTaskCode(long taskCode) { f (actveTaskProcessorMaps.contansKey(taskCode)) { return Optonal.ofNullable(actveTaskProcessorMaps.get(taskCode).taskInstance()); } return Optonal.empty(); } publc Optonal<TaskInstance> getRetryTaskInstanceByTaskCode(long taskCode) { f (watToRetryTaskInstanceMap.contansKey(taskCode)) { return Optonal.ofNullable(watToRetryTaskInstanceMap.get(taskCode)); } return Optonal.empty(); } prvate boolean processStateChangeHandler(StateEvent stateEvent) { try { logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus()); f (stateEvent.getExecutonStatus() == ExecutonStatus.STOP) { f (processDefnton.getExecutonType().typeIsSeralWat()){ endProcess();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,452
[Feature] Serial wait for policy recovery.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Serial wait for policy recovery. ### Use case Serial wait for policy recovery. ### Related issues No ### Are you willing to submit a 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/10452
https://github.com/apache/dolphinscheduler/pull/10453
6396fa996563622a5ded29cbcae42d91db24d611
f46faa02c39b6c31c345fdc75218b3fc15f64ae3
2022-06-15T07:04:51Z
java
2022-06-22T06:28:50Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
return true; } ths.updateProcessInstanceState(stateEvent); return true; } f (processComplementData()) { return true; } f (stateEvent.getExecutonStatus().typeIsFnshed()) { endProcess(); } 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 { Optonal<TaskInstance> taskInstanceOptonal = getTaskInstance(stateEvent.getTaskInstanceId()); TaskInstance task = taskInstanceOptonal.orElseThrow( () -> new RuntmeExcepton("Cannot fnd taskInstance by taskInstanceId:" + 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);