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
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java | definitionId, dateInterval
);
if(lastManualProcess ==null){
return lastSchedulerProcess;
}
if(lastSchedulerProcess == null){
return lastManualProcess;
}
return (lastManualProcess.getEndTime().after(lastSchedulerProcess.getEndTime()))?
lastManualProcess : lastSchedulerProcess;
}
/**
* get dependent result by task/process instance state
* @param state state
* @return DependResult
*/
private DependResult getDependResultByState(ExecutionStatus state) {
if(state.typeIsRunning()
|| state == ExecutionStatus.SUBMITTED_SUCCESS
|| state == ExecutionStatus.WAITTING_THREAD){
return DependResult.WAITING;
}else if(state.typeIsSuccess()){
return DependResult.SUCCESS;
}else{
return DependResult.FAILED;
}
}
/**
* get dependent result by task instance state when task instance is null
* @param state state |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java | * @return DependResult
*/
private DependResult getDependResultByProcessStateWhenTaskNull(ExecutionStatus state) {
if(state.typeIsRunning()
|| state == ExecutionStatus.SUBMITTED_SUCCESS
|| state == ExecutionStatus.WAITTING_THREAD){
return DependResult.WAITING;
}else{
return DependResult.FAILED;
}
}
/**
* judge depend item finished
* @param currentTime current time
* @return boolean
*/
public boolean finish(Date currentTime){
if(modelDependResult == DependResult.WAITING){
modelDependResult = getModelDependResult(currentTime);
return false;
}
return true;
}
/**
* get model depend result
* @param currentTime current time
* @return DependResult
*/
public DependResult getModelDependResult(Date currentTime){
List<DependResult> dependResultList = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java | for(DependentItem dependentItem : dependItemList){
DependResult dependResult = getDependResultForItem(dependentItem, currentTime);
if(dependResult != DependResult.WAITING){
dependResultMap.put(dependentItem.getKey(), dependResult);
}
dependResultList.add(dependResult);
}
modelDependResult = DependentUtils.getDependResultForRelation(
this.relation, dependResultList
);
return modelDependResult;
}
/**
* get dependent item result
* @param item item
* @param currentTime current time
* @return DependResult
*/
private DependResult getDependResultForItem(DependentItem item, Date currentTime){
String key = item.getKey();
if(dependResultMap.containsKey(key)){
return dependResultMap.get(key);
}
return getDependentResultForItem(item, currentTime);
}
public Map<String, DependResult> getDependResultMap(){
return dependResultMap;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/DependentTaskTest.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 | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/DependentTaskTest.java | */
package org.apache.dolphinscheduler.server.master;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.model.DateInterval;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.dependent.DependentDateUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.runner.DependentTaskExecThread;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RunWith(MockitoJUnitRunner.Silent.class)
public class DependentTaskTest {
private static final Logger logger = LoggerFactory.getLogger(DependentTaskTest.class);
private ProcessService processService;
private ApplicationContext applicationContext; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/DependentTaskTest.java | private MasterConfig config;
@Before
public void before() throws Exception{
config = new MasterConfig();
config.setMasterTaskCommitRetryTimes(3);
config.setMasterTaskCommitInterval(1000);
processService = Mockito.mock(ProcessService.class);
DateInterval dateInterval =DependentDateUtils.getTodayInterval(new Date()).get(0);
Mockito.when(processService
.findLastRunningProcess(4, dateInterval.getStartTime(),
dateInterval.getEndTime()))
.thenReturn(findLastProcessInterval());
Mockito.when(processService
.getTaskNodeListByDefinitionId(4))
.thenReturn(getTaskNodes());
Mockito.when(processService
.findValidTaskListByProcessId(11))
.thenReturn(getTaskInstances());
Mockito.when(processService
.findTaskInstanceById(252612))
.thenReturn(getTaskInstance());
Mockito.when(processService.findProcessInstanceById(10111))
.thenReturn(getProcessInstance());
Mockito.when(processService.findProcessDefineById(0))
.thenReturn(getProcessDefinition());
Mockito.when(processService.saveTaskInstance(getTaskInstance()))
.thenReturn(true);
applicationContext = Mockito.mock(ApplicationContext.class);
SpringApplicationContext springApplicationContext = new SpringApplicationContext();
springApplicationContext.setApplicationContext(applicationContext); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/DependentTaskTest.java | Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
Mockito.when(applicationContext.getBean(MasterConfig.class)).thenReturn(config);
}
@Test
public void test() throws Exception{
TaskInstance taskInstance = getTaskInstance();
String dependString = "{\"dependTaskList\":[{\"dependItemList\":[{\"dateValue\":\"today\",\"depTasks\":\"ALL\",\"projectId\":1,\"definitionList\":[{\"label\":\"C\",\"value\":4},{\"label\":\"B\",\"value\":3},{\"label\":\"A\",\"value\":2}],\"cycle\":\"day\",\"definitionId\":4}],\"relation\":\"AND\"}],\"relation\":\"AND\"}";
taskInstance.setDependency(dependString);
Mockito.when(processService.submitTask(taskInstance))
.thenReturn(taskInstance);
DependentTaskExecThread dependentTask =
new DependentTaskExecThread(taskInstance);
dependentTask.call();
Assert.assertEquals(ExecutionStatus.SUCCESS, dependentTask.getTaskInstance().getState());
}
private ProcessInstance findLastProcessInterval(){
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(11);
processInstance.setProcessDefinitionId(4);
processInstance.setState(ExecutionStatus.SUCCESS);
return processInstance;
}
private ProcessDefinition getProcessDefinition(){
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(0);
return processDefinition;
}
private ProcessInstance getProcessInstance(){
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(10111); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/DependentTaskTest.java | processInstance.setProcessDefinitionId(0);
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
return processInstance;
}
private List<TaskNode> getTaskNodes(){
List<TaskNode> list = new ArrayList<>();
TaskNode taskNode = new TaskNode();
taskNode.setName("C");
taskNode.setType("SQL");
list.add(taskNode);
return list;
}
private List<TaskInstance> getTaskInstances(){
List<TaskInstance> list = new ArrayList<>();
TaskInstance taskInstance = new TaskInstance();
taskInstance.setName("C");
taskInstance.setState(ExecutionStatus.SUCCESS);
taskInstance.setDependency("1231");
list.add(taskInstance);
return list;
}
private TaskInstance getTaskInstance(){
TaskInstance taskInstance = new TaskInstance();
taskInstance.setTaskType("DEPENDENT");
taskInstance.setId(252612);
taskInstance.setName("C");
taskInstance.setProcessInstanceId(10111);
return taskInstance;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.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.process;
import com.alibaba.fastjson.JSON; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | import com.alibaba.fastjson.JSONObject;
import com.cronutils.model.Cron;
import org.apache.commons.lang.ArrayUtils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.*;
import org.apache.dolphinscheduler.common.model.DateInterval;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.task.subprocess.SubProcessParameters;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.service.log.LogClientService;
import org.apache.dolphinscheduler.service.quartz.cron.CronUtils;
import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toSet;
import static org.apache.dolphinscheduler.common.Constants.*;
/**
* process relative dao that some mappers in this.
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public class ProcessService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final int[] stateArray = new int[]{ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.RUNNING_EXEUTION.ordinal(),
ExecutionStatus.READY_PAUSE.ordinal(),
ExecutionStatus.READY_STOP.ordinal()};
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionMapper processDefineMapper;
@Autowired
private ProcessInstanceMapper processInstanceMapper;
@Autowired
private DataSourceMapper dataSourceMapper;
@Autowired
private ProcessInstanceMapMapper processInstanceMapMapper;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private CommandMapper commandMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | private ScheduleMapper scheduleMapper;
@Autowired
private UdfFuncMapper udfFuncMapper;
@Autowired
private ResourceMapper resourceMapper;
@Autowired
private ErrorCommandMapper errorCommandMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private ProjectMapper projectMapper;
/**
* handle Command (construct ProcessInstance from Command) , wrapped in transaction
* @param logger logger
* @param host host
* @param validThreadNum validThreadNum
* @param command found command
* @return process instance
*/
@Transactional(rollbackFor = Exception.class)
public ProcessInstance handleCommand(Logger logger, String host, int validThreadNum, Command command) {
ProcessInstance processInstance = constructProcessInstance(command, host);
if(processInstance == null){
logger.error("scan command, command parameter is error: {}", command);
moveToErrorCommand(command, "process instance is null");
return null;
}
if(!checkThreadNum(command, validThreadNum)){
logger.info("there is not enough thread for this command: {}", command); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return setWaitingThreadProcess(command, processInstance);
}
if (processInstance.getCommandType().equals(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS)){
delCommandByid(command.getId());
return null;
}
processInstance.setCommandType(command.getCommandType());
processInstance.addHistoryCmd(command.getCommandType());
saveProcessInstance(processInstance);
this.setSubProcessParam(processInstance);
delCommandByid(command.getId());
return processInstance;
}
/**
* save error command, and delete original command
* @param command command
* @param message message
*/
@Transactional(rollbackFor = Exception.class)
public void moveToErrorCommand(Command command, String message) {
ErrorCommand errorCommand = new ErrorCommand(command, message);
this.errorCommandMapper.insert(errorCommand);
delCommandByid(command.getId());
}
/**
* set process waiting thread
* @param command command
* @param processInstance processInstance
* @return process instance
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | private ProcessInstance setWaitingThreadProcess(Command command, ProcessInstance processInstance) {
processInstance.setState(ExecutionStatus.WAITTING_THREAD);
if(command.getCommandType() != CommandType.RECOVER_WAITTING_THREAD){
processInstance.addHistoryCmd(command.getCommandType());
}
saveProcessInstance(processInstance);
this.setSubProcessParam(processInstance);
createRecoveryWaitingThreadCommand(command, processInstance);
return null;
}
/**
* check thread num
* @param command command
* @param validThreadNum validThreadNum
* @return if thread is enough
*/
private boolean checkThreadNum(Command command, int validThreadNum) {
int commandThreadCount = this.workProcessThreadNumCount(command.getProcessDefinitionId());
return validThreadNum >= commandThreadCount;
}
/**
* insert one command
* @param command command
* @return create result
*/
public int createCommand(Command command) {
int result = 0;
if (command != null){
result = commandMapper.insert(command);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return result;
}
/**
* find one command from queue list
* @return command
*/
public Command findOneCommand(){
return commandMapper.getOneToRun();
}
/**
* check the input command exists in queue list
* @param command command
* @return create command result
*/
public Boolean verifyIsNeedCreateCommand(Command command){
Boolean isNeedCreate = true;
Map<CommandType,Integer> cmdTypeMap = new HashMap<CommandType,Integer>();
cmdTypeMap.put(CommandType.REPEAT_RUNNING,1);
cmdTypeMap.put(CommandType.RECOVER_SUSPENDED_PROCESS,1);
cmdTypeMap.put(CommandType.START_FAILURE_TASK_PROCESS,1);
CommandType commandType = command.getCommandType();
if(cmdTypeMap.containsKey(commandType)){
JSONObject cmdParamObj = (JSONObject) JSON.parse(command.getCommandParam());
JSONObject tempObj;
int processInstanceId = cmdParamObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING);
List<Command> commands = commandMapper.selectList(null);
for (Command tmpCommand:commands){
if(cmdTypeMap.containsKey(tmpCommand.getCommandType())){
tempObj = (JSONObject) JSON.parse(tmpCommand.getCommandParam()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if(tempObj != null && processInstanceId == tempObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING)){
isNeedCreate = false;
break;
}
}
}
}
return isNeedCreate;
}
/**
* find process instance detail by id
* @param processId processId
* @return process instance
*/
public ProcessInstance findProcessInstanceDetailById(int processId){
return processInstanceMapper.queryDetailById(processId);
}
/**
* get task node list by definitionId
* @param defineId
* @return
*/
public List<TaskNode> getTaskNodeListByDefinitionId(Integer defineId){
ProcessDefinition processDefinition = processDefineMapper.selectById(defineId);
if (processDefinition == null) {
logger.info("process define not exists");
return null;
}
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if (null == processData) {
logger.error("process data is null");
return null;
}
return processData.getTasks();
}
/**
* find process instance by id
* @param processId processId
* @return process instance
*/
public ProcessInstance findProcessInstanceById(int processId){
return processInstanceMapper.selectById(processId);
}
/**
* find process define by id.
* @param processDefinitionId processDefinitionId
* @return process definition
*/
public ProcessDefinition findProcessDefineById(int processDefinitionId) {
return processDefineMapper.selectById(processDefinitionId);
}
/**
* delete work process instance by id
* @param processInstanceId processInstanceId
* @return delete process instance result
*/
public int deleteWorkProcessInstanceById(int processInstanceId){
return processInstanceMapper.deleteById(processInstanceId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* delete all sub process by parent instance id
* @param processInstanceId processInstanceId
* @return delete all sub process instance result
*/
public int deleteAllSubWorkProcessByParentId(int processInstanceId){
List<Integer> subProcessIdList = processInstanceMapMapper.querySubIdListByParentId(processInstanceId);
for(Integer subId : subProcessIdList){
deleteAllSubWorkProcessByParentId(subId);
deleteWorkProcessMapByParentId(subId);
removeTaskLogFile(subId);
deleteWorkProcessInstanceById(subId);
}
return 1;
}
/**
* remove task log file
* @param processInstanceId processInstanceId
*/
public void removeTaskLogFile(Integer processInstanceId){
LogClientService logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)){
return;
}
for (TaskInstance taskInstance : taskInstanceList){
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())){
continue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
String ip = Host.of(taskInstance.getHost()).getIp();
int port = Constants.RPC_PORT;
logClient.removeTaskLog(ip,port,taskLogPath);
}
}
/**
* calculate sub process number in the process define.
* @param processDefinitionId processDefinitionId
* @return process thread num count
*/
private Integer workProcessThreadNumCount(Integer processDefinitionId){
List<Integer> ids = new ArrayList<>();
recurseFindSubProcessId(processDefinitionId, ids);
return ids.size()+1;
}
/**
* recursive query sub process definition id by parent id.
* @param parentId parentId
* @param ids ids
*/
public void recurseFindSubProcessId(int parentId, List<Integer> ids){
ProcessDefinition processDefinition = processDefineMapper.selectById(parentId);
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
List<TaskNode> taskNodeList = processData.getTasks();
if (taskNodeList != null && taskNodeList.size() > 0){
for (TaskNode taskNode : taskNodeList){
String parameter = taskNode.getParams(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | JSONObject parameterJson = JSONObject.parseObject(parameter);
if (parameterJson.getInteger(CMDPARAM_SUB_PROCESS_DEFINE_ID) != null){
SubProcessParameters subProcessParam = JSON.parseObject(parameter, SubProcessParameters.class);
ids.add(subProcessParam.getProcessDefinitionId());
recurseFindSubProcessId(subProcessParam.getProcessDefinitionId(),ids);
}
}
}
}
/**
* create recovery waiting thread command when thread pool is not enough for the process instance.
* sub work process instance need not to create recovery command.
* create recovery waiting thread command and delete origin command at the same time.
* if the recovery command is exists, only update the field update_time
* @param originCommand originCommand
* @param processInstance processInstance
*/
public void createRecoveryWaitingThreadCommand(Command originCommand, ProcessInstance processInstance) {
if(processInstance.getIsSubProcess() == Flag.YES){
if(originCommand != null){
commandMapper.deleteById(originCommand.getId());
}
return;
}
Map<String, String> cmdParam = new HashMap<>();
cmdParam.put(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD, String.valueOf(processInstance.getId()));
if(originCommand == null){
Command command = new Command( |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | CommandType.RECOVER_WAITTING_THREAD,
processInstance.getTaskDependType(),
processInstance.getFailureStrategy(),
processInstance.getExecutorId(),
processInstance.getProcessDefinitionId(),
JSONUtils.toJson(cmdParam),
processInstance.getWarningType(),
processInstance.getWarningGroupId(),
processInstance.getScheduleTime(),
processInstance.getProcessInstancePriority()
);
saveCommand(command);
return ;
}
if(originCommand.getCommandType() == CommandType.RECOVER_WAITTING_THREAD){
originCommand.setUpdateTime(new Date());
saveCommand(originCommand);
}else{
commandMapper.deleteById(originCommand.getId());
originCommand.setId(0);
originCommand.setCommandType(CommandType.RECOVER_WAITTING_THREAD);
originCommand.setUpdateTime(new Date());
originCommand.setCommandParam(JSONUtils.toJson(cmdParam));
originCommand.setProcessInstancePriority(processInstance.getProcessInstancePriority());
saveCommand(originCommand);
}
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * get schedule time from command
* @param command command
* @param cmdParam cmdParam map
* @return date
*/
private Date getScheduleTime(Command command, Map<String, String> cmdParam){
Date scheduleTime = command.getScheduleTime();
if(scheduleTime == null){
if(cmdParam != null && cmdParam.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)){
scheduleTime = DateUtils.stringToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));
}
}
return scheduleTime;
}
/**
* generate a new work process instance from command.
* @param processDefinition processDefinition
* @param command command
* @param cmdParam cmdParam map
* @return process instance
*/
private ProcessInstance generateNewProcessInstance(ProcessDefinition processDefinition,
Command command,
Map<String, String> cmdParam){
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
processInstance.setRecovery(Flag.NO);
processInstance.setStartTime(new Date());
processInstance.setRunTimes(1);
processInstance.setMaxTryTimes(0); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstance.setProcessDefinitionId(command.getProcessDefinitionId());
processInstance.setCommandParam(command.getCommandParam());
processInstance.setCommandType(command.getCommandType());
processInstance.setIsSubProcess(Flag.NO);
processInstance.setTaskDependType(command.getTaskDependType());
processInstance.setFailureStrategy(command.getFailureStrategy());
processInstance.setExecutorId(command.getExecutorId());
WarningType warningType = command.getWarningType() == null ? WarningType.NONE : command.getWarningType();
processInstance.setWarningType(warningType);
Integer warningGroupId = command.getWarningGroupId() == null ? 0 : command.getWarningGroupId();
processInstance.setWarningGroupId(warningGroupId);
Date scheduleTime = getScheduleTime(command, cmdParam);
if(scheduleTime != null){
processInstance.setScheduleTime(scheduleTime);
}
processInstance.setCommandStartTime(command.getStartTime());
processInstance.setLocations(processDefinition.getLocations());
processInstance.setConnects(processDefinition.getConnects());
processInstance.setGlobalParams(ParameterUtils.curingGlobalParams(
processDefinition.getGlobalParamMap(),
processDefinition.getGlobalParamList(),
getCommandTypeIfComplement(processInstance, command),
processInstance.getScheduleTime()));
processInstance.setProcessInstanceJson(processDefinition.getProcessDefinitionJson());
processInstance.setProcessInstancePriority(command.getProcessInstancePriority());
String workerGroup = StringUtils.isBlank(command.getWorkerGroup()) ? Constants.DEFAULT_WORKER_GROUP : command.getWorkerGroup(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstance.setWorkerGroup(workerGroup);
processInstance.setTimeout(processDefinition.getTimeout());
processInstance.setTenantId(processDefinition.getTenantId());
return processInstance;
}
/**
* get process tenant
* there is tenant id in definition, use the tenant of the definition.
* if there is not tenant id in the definiton or the tenant not exist
* use definition creator's tenant.
* @param tenantId tenantId
* @param userId userId
* @return tenant
*/
public Tenant getTenantForProcess(int tenantId, int userId){
Tenant tenant = null;
if(tenantId >= 0){
tenant = tenantMapper.queryById(tenantId);
}
if (userId == 0){
return null;
}
if(tenant == null){
User user = userMapper.selectById(userId);
tenant = tenantMapper.queryById(user.getTenantId());
}
return tenant;
}
/**
* check command parameters is valid |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param command command
* @param cmdParam cmdParam map
* @return whether command param is valid
*/
private Boolean checkCmdParam(Command command, Map<String, String> cmdParam){
if(command.getTaskDependType() == TaskDependType.TASK_ONLY || command.getTaskDependType()== TaskDependType.TASK_PRE){
if(cmdParam == null
|| !cmdParam.containsKey(Constants.CMDPARAM_START_NODE_NAMES)
|| cmdParam.get(Constants.CMDPARAM_START_NODE_NAMES).isEmpty()){
logger.error("command node depend type is {}, but start nodes is null ", command.getTaskDependType());
return false;
}
}
return true;
}
/**
* construct process instance according to one command.
* @param command command
* @param host host
* @return process instance
*/
private ProcessInstance constructProcessInstance(Command command, String host){
ProcessInstance processInstance = null;
CommandType commandType = command.getCommandType();
Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam());
ProcessDefinition processDefinition = null;
if(command.getProcessDefinitionId() != 0){
processDefinition = processDefineMapper.selectById(command.getProcessDefinitionId());
if(processDefinition == null){
logger.error("cannot find the work process define! define id : {}", command.getProcessDefinitionId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return null;
}
}
if(cmdParam != null ){
Integer processInstanceId = 0;
if(cmdParam.containsKey(Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING)) {
String processId = cmdParam.get(Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING);
processInstanceId = Integer.parseInt(processId);
if (processInstanceId == 0) {
logger.error("command parameter is error, [ ProcessInstanceId ] is 0");
return null;
}
}else if(cmdParam.containsKey(Constants.CMDPARAM_SUB_PROCESS)){
String pId = cmdParam.get(Constants.CMDPARAM_SUB_PROCESS);
processInstanceId = Integer.parseInt(pId);
}else if(cmdParam.containsKey(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD)){
String pId = cmdParam.get(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD);
processInstanceId = Integer.parseInt(pId);
}
if(processInstanceId ==0){
processInstance = generateNewProcessInstance(processDefinition, command, cmdParam);
}else{
processInstance = this.findProcessInstanceDetailById(processInstanceId);
}
processDefinition = processDefineMapper.selectById(processInstance.getProcessDefinitionId());
processInstance.setProcessDefinition(processDefinition); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if(processInstance.getCommandParam() != null){
Map<String, String> processCmdParam = JSONUtils.toMap(processInstance.getCommandParam());
for(Map.Entry<String, String> entry: processCmdParam.entrySet()) {
if(!cmdParam.containsKey(entry.getKey())){
cmdParam.put(entry.getKey(), entry.getValue());
}
}
}
if(cmdParam.containsKey(Constants.CMDPARAM_SUB_PROCESS)){
processInstance.setCommandParam(command.getCommandParam());
}
}else{
processInstance = generateNewProcessInstance(processDefinition, command, cmdParam);
}
if(!checkCmdParam(command, cmdParam)){
logger.error("command parameter check failed!");
return null;
}
if(command.getScheduleTime() != null){
processInstance.setScheduleTime(command.getScheduleTime());
}
processInstance.setHost(host);
ExecutionStatus runStatus = ExecutionStatus.RUNNING_EXEUTION;
int runTime = processInstance.getRunTimes();
switch (commandType){
case START_PROCESS:
break;
case START_FAILURE_TASK_PROCESS: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<Integer> failedList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.FAILURE);
List<Integer> toleranceList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.NEED_FAULT_TOLERANCE);
List<Integer> killedList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.KILL);
cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING);
failedList.addAll(killedList);
failedList.addAll(toleranceList);
for(Integer taskId : failedList){
initTaskInstance(this.findTaskInstanceById(taskId));
}
cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING,
String.join(Constants.COMMA, convertIntListToString(failedList)));
processInstance.setCommandParam(JSONUtils.toJson(cmdParam));
processInstance.setRunTimes(runTime +1 );
break;
case START_CURRENT_TASK_PROCESS:
break;
case RECOVER_WAITTING_THREAD:
break;
case RECOVER_SUSPENDED_PROCESS:
cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING);
List<Integer> suspendedNodeList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.PAUSE);
List<Integer> stopNodeList = findTaskIdByInstanceState(processInstance.getId(),
ExecutionStatus.KILL);
suspendedNodeList.addAll(stopNodeList);
for(Integer taskId : suspendedNodeList){
initTaskInstance(this.findTaskInstanceById(taskId));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING, String.join(",", convertIntListToString(suspendedNodeList)));
processInstance.setCommandParam(JSONUtils.toJson(cmdParam));
processInstance.setRunTimes(runTime +1);
break;
case RECOVER_TOLERANCE_FAULT_PROCESS:
processInstance.setRecovery(Flag.YES);
runStatus = processInstance.getState();
break;
case COMPLEMENT_DATA:
List<TaskInstance> taskInstanceList = this.findValidTaskListByProcessId(processInstance.getId());
for(TaskInstance taskInstance : taskInstanceList){
taskInstance.setFlag(Flag.NO);
this.updateTaskInstance(taskInstance);
}
initComplementDataParam(processDefinition, processInstance, cmdParam);
break;
case REPEAT_RUNNING:
if(cmdParam.containsKey(Constants.CMDPARAM_RECOVERY_START_NODE_STRING)){
cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING);
processInstance.setCommandParam(JSONUtils.toJson(cmdParam));
}
List<TaskInstance> validTaskList = findValidTaskListByProcessId(processInstance.getId());
for(TaskInstance taskInstance : validTaskList){
taskInstance.setFlag(Flag.NO);
updateTaskInstance(taskInstance);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstance.setStartTime(new Date());
processInstance.setEndTime(null);
processInstance.setRunTimes(runTime +1);
initComplementDataParam(processDefinition, processInstance, cmdParam);
break;
case SCHEDULER:
break;
default:
break;
}
processInstance.setState(runStatus);
return processInstance;
}
/**
* return complement data if the process start with complement data
* @param processInstance processInstance
* @param command command
* @return command type
*/
private CommandType getCommandTypeIfComplement(ProcessInstance processInstance, Command command){
if(CommandType.COMPLEMENT_DATA == processInstance.getCmdTypeIfComplement()){
return CommandType.COMPLEMENT_DATA;
}else{
return command.getCommandType();
}
}
/**
* initialize complement data parameters
* @param processDefinition processDefinition
* @param processInstance processInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param cmdParam cmdParam
*/
private void initComplementDataParam(ProcessDefinition processDefinition,
ProcessInstance processInstance,
Map<String, String> cmdParam) {
if(!processInstance.isComplementData()){
return;
}
Date startComplementTime = DateUtils.parse(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE),
YYYY_MM_DD_HH_MM_SS);
if(Flag.NO == processInstance.getIsSubProcess()) {
processInstance.setScheduleTime(startComplementTime);
}
processInstance.setGlobalParams(ParameterUtils.curingGlobalParams(
processDefinition.getGlobalParamMap(),
processDefinition.getGlobalParamList(),
CommandType.COMPLEMENT_DATA, processInstance.getScheduleTime()));
}
/**
* set sub work process parameters.
* handle sub work process instance, update relation table and command parameters
* set sub work process flag, extends parent work process command parameters
* @param subProcessInstance subProcessInstance
* @return process instance
*/
public ProcessInstance setSubProcessParam(ProcessInstance subProcessInstance){
String cmdParam = subProcessInstance.getCommandParam();
if(StringUtils.isEmpty(cmdParam)){
return subProcessInstance;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | Map<String, String> paramMap = JSONUtils.toMap(cmdParam);
if(paramMap.containsKey(CMDPARAM_SUB_PROCESS)
&& CMDPARAM_EMPTY_SUB_PROCESS.equals(paramMap.get(CMDPARAM_SUB_PROCESS))){
paramMap.remove(CMDPARAM_SUB_PROCESS);
paramMap.put(CMDPARAM_SUB_PROCESS, String.valueOf(subProcessInstance.getId()));
subProcessInstance.setCommandParam(JSONUtils.toJson(paramMap));
subProcessInstance.setIsSubProcess(Flag.YES);
this.saveProcessInstance(subProcessInstance);
}
String parentInstanceId = paramMap.get(CMDPARAM_SUB_PROCESS_PARENT_INSTANCE_ID);
if(StringUtils.isNotEmpty(parentInstanceId)){
ProcessInstance parentInstance = findProcessInstanceDetailById(Integer.parseInt(parentInstanceId));
if(parentInstance != null){
subProcessInstance.setGlobalParams(
joinGlobalParams(parentInstance.getGlobalParams(), subProcessInstance.getGlobalParams()));
this.saveProcessInstance(subProcessInstance);
}else{
logger.error("sub process command params error, cannot find parent instance: {} ", cmdParam);
}
}
ProcessInstanceMap processInstanceMap = JSONUtils.parseObject(cmdParam, ProcessInstanceMap.class);
if(processInstanceMap == null || processInstanceMap.getParentProcessInstanceId() == 0){
return subProcessInstance;
}
processInstanceMap.setProcessInstanceId(subProcessInstance.getId());
this.updateWorkProcessInstanceMap(processInstanceMap);
return subProcessInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* join parent global params into sub process.
* only the keys doesn't in sub process global would be joined.
* @param parentGlobalParams parentGlobalParams
* @param subGlobalParams subGlobalParams
* @return global params join
*/
private String joinGlobalParams(String parentGlobalParams, String subGlobalParams){
List<Property> parentPropertyList = JSONUtils.toList(parentGlobalParams, Property.class);
List<Property> subPropertyList = JSONUtils.toList(subGlobalParams, Property.class);
Map<String,String> subMap = subPropertyList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
for(Property parent : parentPropertyList){
if(!subMap.containsKey(parent.getProp())){
subPropertyList.add(parent);
}
}
return JSONUtils.toJson(subPropertyList);
}
/**
* initialize task instance
* @param taskInstance taskInstance
*/
private void initTaskInstance(TaskInstance taskInstance){
if(!taskInstance.isSubProcess()){
if(taskInstance.getState().typeIsCancel() || taskInstance.getState().typeIsFailure()){
taskInstance.setFlag(Flag.NO);
updateTaskInstance(taskInstance);
return;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
updateTaskInstance(taskInstance);
}
/**
* submit task to db
* submit sub process to command
* @param taskInstance taskInstance
* @return task instance
*/
@Transactional(rollbackFor = Exception.class)
public TaskInstance submitTask(TaskInstance taskInstance){
ProcessInstance processInstance = this.findProcessInstanceDetailById(taskInstance.getProcessInstanceId());
logger.info("start submit task : {}, instance id:{}, state: {}",
taskInstance.getName(), taskInstance.getProcessInstanceId(), processInstance.getState());
TaskInstance task = submitTaskInstanceToDB(taskInstance, processInstance);
if(task == null){
logger.error("end submit task to db error, task name:{}, process id:{} state: {} ",
taskInstance.getName(), taskInstance.getProcessInstance(), processInstance.getState());
return task;
}
if(!task.getState().typeIsFinished()){
createSubWorkProcessCommand(processInstance, task);
}
logger.info("end submit task to db successfully:{} state:{} complete, instance id:{} state: {} ",
taskInstance.getName(), task.getState(), processInstance.getId(), processInstance.getState());
return task;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * set work process instance map
* @param parentInstance parentInstance
* @param parentTask parentTask
* @return process instance map
*/
private ProcessInstanceMap setProcessInstanceMap(ProcessInstance parentInstance, TaskInstance parentTask){
ProcessInstanceMap processMap = findWorkProcessMapByParent(parentInstance.getId(), parentTask.getId());
if(processMap != null){
return processMap;
}else if(parentInstance.getCommandType() == CommandType.REPEAT_RUNNING
|| parentInstance.isComplementData()){
processMap = findPreviousTaskProcessMap(parentInstance, parentTask);
if(processMap!= null){
processMap.setParentTaskInstanceId(parentTask.getId());
updateWorkProcessInstanceMap(processMap);
return processMap;
}
}
processMap = new ProcessInstanceMap();
processMap.setParentProcessInstanceId(parentInstance.getId());
processMap.setParentTaskInstanceId(parentTask.getId());
createWorkProcessInstanceMap(processMap);
return processMap;
}
/**
* find previous task work process map.
* @param parentProcessInstance parentProcessInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param parentTask parentTask
* @return process instance map
*/
private ProcessInstanceMap findPreviousTaskProcessMap(ProcessInstance parentProcessInstance,
TaskInstance parentTask) {
Integer preTaskId = 0;
List<TaskInstance> preTaskList = this.findPreviousTaskListByWorkProcessId(parentProcessInstance.getId());
for(TaskInstance task : preTaskList){
if(task.getName().equals(parentTask.getName())){
preTaskId = task.getId();
ProcessInstanceMap map = findWorkProcessMapByParent(parentProcessInstance.getId(), preTaskId);
if(map!=null){
return map;
}
}
}
logger.info("sub process instance is not found,parent task:{},parent instance:{}",
parentTask.getId(), parentProcessInstance.getId());
return null;
}
/**
* create sub work process command
* @param parentProcessInstance parentProcessInstance
* @param task task
*/
private void createSubWorkProcessCommand(ProcessInstance parentProcessInstance,
TaskInstance task){
if(!task.isSubProcess()){
return;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | ProcessInstanceMap instanceMap = setProcessInstanceMap(parentProcessInstance, task);
TaskNode taskNode = JSONUtils.parseObject(task.getTaskJson(), TaskNode.class);
Map<String, String> subProcessParam = JSONUtils.toMap(taskNode.getParams());
Integer childDefineId = Integer.parseInt(subProcessParam.get(Constants.CMDPARAM_SUB_PROCESS_DEFINE_ID));
ProcessInstance childInstance = findSubProcessInstance(parentProcessInstance.getId(), task.getId());
CommandType fatherType = parentProcessInstance.getCommandType();
CommandType commandType = fatherType;
if(childInstance == null || commandType == CommandType.REPEAT_RUNNING){
String fatherHistoryCommand = parentProcessInstance.getHistoryCmd();
if(fatherHistoryCommand.startsWith(CommandType.SCHEDULER.toString()) ||
fatherHistoryCommand.startsWith(CommandType.COMPLEMENT_DATA.toString())){
commandType = CommandType.valueOf(fatherHistoryCommand.split(Constants.COMMA)[0]);
}
}
if(childInstance != null){
childInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
updateProcessInstance(childInstance);
}
String processMapStr = JSONUtils.toJson(instanceMap);
Map<String, String> cmdParam = JSONUtils.toMap(processMapStr);
if(commandType == CommandType.COMPLEMENT_DATA ||
(childInstance != null && childInstance.isComplementData())){
Map<String, String> parentParam = JSONUtils.toMap(parentProcessInstance.getCommandParam());
String endTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE);
String startTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE);
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endTime);
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startTime); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processMapStr = JSONUtils.toJson(cmdParam);
}
updateSubProcessDefinitionByParent(parentProcessInstance, childDefineId);
Command command = new Command();
command.setWarningType(parentProcessInstance.getWarningType());
command.setWarningGroupId(parentProcessInstance.getWarningGroupId());
command.setFailureStrategy(parentProcessInstance.getFailureStrategy());
command.setProcessDefinitionId(childDefineId);
command.setScheduleTime(parentProcessInstance.getScheduleTime());
command.setExecutorId(parentProcessInstance.getExecutorId());
command.setCommandParam(processMapStr);
command.setCommandType(commandType);
command.setProcessInstancePriority(parentProcessInstance.getProcessInstancePriority());
command.setWorkerGroup(parentProcessInstance.getWorkerGroup());
createCommand(command);
logger.info("sub process command created: {} ", command.toString());
}
/**
* update sub process definition
* @param parentProcessInstance parentProcessInstance
* @param childDefinitionId childDefinitionId
*/
private void updateSubProcessDefinitionByParent(ProcessInstance parentProcessInstance, int childDefinitionId) {
ProcessDefinition fatherDefinition = this.findProcessDefineById(parentProcessInstance.getProcessDefinitionId());
ProcessDefinition childDefinition = this.findProcessDefineById(childDefinitionId);
if(childDefinition != null && fatherDefinition != null){
childDefinition.setReceivers(fatherDefinition.getReceivers());
childDefinition.setReceiversCc(fatherDefinition.getReceiversCc());
processDefineMapper.updateById(childDefinition);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* submit task to mysql
* @param taskInstance taskInstance
* @param processInstance processInstance
* @return task instance
*/
public TaskInstance submitTaskInstanceToDB(TaskInstance taskInstance, ProcessInstance processInstance){
ExecutionStatus processInstanceState = processInstance.getState();
if(taskInstance.getState().typeIsFailure()){
if(taskInstance.isSubProcess()){
taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1 );
}else {
if( processInstanceState != ExecutionStatus.READY_STOP
&& processInstanceState != ExecutionStatus.READY_PAUSE){
taskInstance.setFlag(Flag.NO);
updateTaskInstance(taskInstance);
if(taskInstance.getState() != ExecutionStatus.NEED_FAULT_TOLERANCE){
taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1 );
}
taskInstance.setEndTime(null);
taskInstance.setStartTime(new Date());
taskInstance.setFlag(Flag.YES);
taskInstance.setHost(null);
taskInstance.setId(0);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | taskInstance.setExecutorId(processInstance.getExecutorId());
taskInstance.setProcessInstancePriority(processInstance.getProcessInstancePriority());
taskInstance.setState(getSubmitTaskState(taskInstance, processInstanceState));
taskInstance.setSubmitTime(new Date());
boolean saveResult = saveTaskInstance(taskInstance);
if(!saveResult){
return null;
}
return taskInstance;
}
/**
* ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskInstanceId}_${task executed by ip1},${ip2}...
* The tasks with the highest priority are selected by comparing the priorities of the above four levels from high to low.
* @param taskInstance taskInstance
* @return task zk queue str
*/
public String taskZkInfo(TaskInstance taskInstance) {
String taskWorkerGroup = getTaskWorkerGroup(taskInstance);
ProcessInstance processInstance = this.findProcessInstanceById(taskInstance.getProcessInstanceId());
if(processInstance == null){
logger.error("process instance is null. please check the task info, task id: " + taskInstance.getId());
return "";
}
StringBuilder sb = new StringBuilder(100);
sb.append(processInstance.getProcessInstancePriority().ordinal()).append(Constants.UNDERLINE)
.append(taskInstance.getProcessInstanceId()).append(Constants.UNDERLINE)
.append(taskInstance.getTaskInstancePriority().ordinal()).append(Constants.UNDERLINE)
.append(taskInstance.getId()).append(Constants.UNDERLINE)
.append(taskInstance.getWorkerGroup());
return sb.toString(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* get submit task instance state by the work process state
* cannot modify the task state when running/kill/submit success, or this
* task instance is already exists in task queue .
* return pause if work process state is ready pause
* return stop if work process state is ready stop
* if all of above are not satisfied, return submit success
*
* @param taskInstance taskInstance
* @param processInstanceState processInstanceState
* @return process instance state
*/
public ExecutionStatus getSubmitTaskState(TaskInstance taskInstance, ExecutionStatus processInstanceState){
ExecutionStatus state = taskInstance.getState();
if(
state == ExecutionStatus.RUNNING_EXEUTION
|| state == ExecutionStatus.KILL
|| checkTaskExistsInTaskQueue(taskInstance)
){
return state;
}
if( processInstanceState == ExecutionStatus.READY_PAUSE){
state = ExecutionStatus.PAUSE;
}else if(processInstanceState == ExecutionStatus.READY_STOP |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | || !checkProcessStrategy(taskInstance)) {
state = ExecutionStatus.KILL;
}else{
state = ExecutionStatus.SUBMITTED_SUCCESS;
}
return state;
}
/**
* check process instance strategy
* @param taskInstance taskInstance
* @return check strategy result
*/
private boolean checkProcessStrategy(TaskInstance taskInstance){
ProcessInstance processInstance = this.findProcessInstanceById(taskInstance.getProcessInstanceId());
FailureStrategy failureStrategy = processInstance.getFailureStrategy();
if(failureStrategy == FailureStrategy.CONTINUE){
return true;
}
List<TaskInstance> taskInstances = this.findValidTaskListByProcessId(taskInstance.getProcessInstanceId());
for(TaskInstance task : taskInstances){
if(task.getState() == ExecutionStatus.FAILURE){
return false;
}
}
return true;
}
/**
* check the task instance existing in queue
* @param taskInstance taskInstance
* @return whether taskinstance exists queue |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public boolean checkTaskExistsInTaskQueue(TaskInstance taskInstance){
if(taskInstance.isSubProcess()){
return false;
}
String taskZkInfo = taskZkInfo(taskInstance);
return false;
}
/**
* create a new process instance
* @param processInstance processInstance
*/
public void createProcessInstance(ProcessInstance processInstance){
if (processInstance != null){
processInstanceMapper.insert(processInstance);
}
}
/**
* insert or update work process instance to data base
* @param processInstance processInstance
*/
public void saveProcessInstance(ProcessInstance processInstance){
if (processInstance == null){
logger.error("save error, process instance is null!");
return ;
}
if(processInstance.getId() != 0){
processInstanceMapper.updateById(processInstance);
}else{
createProcessInstance(processInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
}
/**
* insert or update command
* @param command command
* @return save command result
*/
public int saveCommand(Command command){
if(command.getId() != 0){
return commandMapper.updateById(command);
}else{
return commandMapper.insert(command);
}
}
/**
* insert or update task instance
* @param taskInstance taskInstance
* @return save task instance result
*/
public boolean saveTaskInstance(TaskInstance taskInstance){
if(taskInstance.getId() != 0){
return updateTaskInstance(taskInstance);
}else{
return createTaskInstance(taskInstance);
}
}
/**
* insert task instance
* @param taskInstance taskInstance
* @return create task instance result |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public boolean createTaskInstance(TaskInstance taskInstance) {
int count = taskInstanceMapper.insert(taskInstance);
return count > 0;
}
/**
* update task instance
* @param taskInstance taskInstance
* @return update task instance result
*/
public boolean updateTaskInstance(TaskInstance taskInstance){
int count = taskInstanceMapper.updateById(taskInstance);
return count > 0;
}
/**
* delete a command by id
* @param id id
*/
public void delCommandByid(int id) {
commandMapper.deleteById(id);
}
/**
* find task instance by id
* @param taskId task id
* @return task intance
*/
public TaskInstance findTaskInstanceById(Integer taskId){
return taskInstanceMapper.selectById(taskId);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * package task instance,associate processInstance and processDefine
* @param taskInstId taskInstId
* @return task instance
*/
public TaskInstance getTaskInstanceDetailByTaskId(int taskInstId){
//
TaskInstance taskInstance = findTaskInstanceById(taskInstId);
if(taskInstance == null){
return taskInstance;
}
//
ProcessInstance processInstance = findProcessInstanceDetailById(taskInstance.getProcessInstanceId());
//
ProcessDefinition processDefine = findProcessDefineById(taskInstance.getProcessDefinitionId());
taskInstance.setProcessInstance(processInstance);
taskInstance.setProcessDefine(processDefine);
return taskInstance;
}
/**
* get id list by task state
* @param instanceId instanceId
* @param state state
* @return task instance states
*/
public List<Integer> findTaskIdByInstanceState(int instanceId, ExecutionStatus state){
return taskInstanceMapper.queryTaskByProcessIdAndState(instanceId, state.ordinal());
}
/**
* find valid task list by process definition id
* @param processInstanceId processInstanceId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @return task instance list
*/
public List<TaskInstance> findValidTaskListByProcessId(Integer processInstanceId){
return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.YES);
}
/**
* find previous task list by work process id
* @param processInstanceId processInstanceId
* @return task instance list
*/
public List<TaskInstance> findPreviousTaskListByWorkProcessId(Integer processInstanceId){
return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.NO);
}
/**
* update work process instance map
* @param processInstanceMap processInstanceMap
* @return update process instance result
*/
public int updateWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap){
return processInstanceMapMapper.updateById(processInstanceMap);
}
/**
* create work process instance map
* @param processInstanceMap processInstanceMap
* @return create process instance result
*/
public int createWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap){
Integer count = 0;
if(processInstanceMap !=null){
return processInstanceMapMapper.insert(processInstanceMap); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
return count;
}
/**
* find work process map by parent process id and parent task id.
* @param parentWorkProcessId parentWorkProcessId
* @param parentTaskId parentTaskId
* @return process instance map
*/
public ProcessInstanceMap findWorkProcessMapByParent(Integer parentWorkProcessId, Integer parentTaskId){
return processInstanceMapMapper.queryByParentId(parentWorkProcessId, parentTaskId);
}
/**
* delete work process map by parent process id
* @param parentWorkProcessId parentWorkProcessId
* @return delete process map result
*/
public int deleteWorkProcessMapByParentId(int parentWorkProcessId){
return processInstanceMapMapper.deleteByParentProcessId(parentWorkProcessId);
}
/**
* find sub process instance
* @param parentProcessId parentProcessId
* @param parentTaskId parentTaskId
* @return process instance
*/
public ProcessInstance findSubProcessInstance(Integer parentProcessId, Integer parentTaskId){
ProcessInstance processInstance = null;
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryByParentId(parentProcessId, parentTaskId);
if(processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getProcessInstanceId());
return processInstance;
}
/**
* find parent process instance
* @param subProcessId subProcessId
* @return process instance
*/
public ProcessInstance findParentProcessInstance(Integer subProcessId) {
ProcessInstance processInstance = null;
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(subProcessId);
if(processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0){
return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getParentProcessInstanceId());
return processInstance;
}
/**
* change task state
* @param state state
* @param startTime startTime
* @param host host
* @param executePath executePath
* @param logPath logPath
* @param taskInstId taskInstId
*/
public void changeTaskState(ExecutionStatus state, Date startTime, String host,
String executePath, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | String logPath,
int taskInstId) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskInstId);
taskInstance.setState(state);
taskInstance.setStartTime(startTime);
taskInstance.setHost(host);
taskInstance.setExecutePath(executePath);
taskInstance.setLogPath(logPath);
saveTaskInstance(taskInstance);
}
/**
* update process instance
* @param processInstance processInstance
* @return update process instance result
*/
public int updateProcessInstance(ProcessInstance processInstance){
return processInstanceMapper.updateById(processInstance);
}
/**
* update the process instance
* @param processInstanceId processInstanceId
* @param processJson processJson
* @param globalParams globalParams
* @param scheduleTime scheduleTime
* @param flag flag
* @param locations locations
* @param connects connects
* @return update process instance result
*/
public int updateProcessInstance(Integer processInstanceId, String processJson, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | String globalParams, Date scheduleTime, Flag flag,
String locations, String connects){
ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId);
if(processInstance!= null){
processInstance.setProcessInstanceJson(processJson);
processInstance.setGlobalParams(globalParams);
processInstance.setScheduleTime(scheduleTime);
processInstance.setLocations(locations);
processInstance.setConnects(connects);
return processInstanceMapper.updateById(processInstance);
}
return 0;
}
/**
* change task state
* @param state state
* @param endTime endTime
* @param taskInstId taskInstId
*/
public void changeTaskState(ExecutionStatus state,
Date endTime,
int processId,
String appIds,
int taskInstId) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskInstId);
taskInstance.setPid(processId);
taskInstance.setAppLink(appIds);
taskInstance.setState(state);
taskInstance.setEndTime(endTime);
saveTaskInstance(taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* convert integer list to string list
* @param intList intList
* @return string list
*/
public List<String> convertIntListToString(List<Integer> intList){
if(intList == null){
return new ArrayList<>();
}
List<String> result = new ArrayList<String>(intList.size());
for(Integer intVar : intList){
result.add(String.valueOf(intVar));
}
return result;
}
/**
* update pid and app links field by task instance id
* @param taskInstId taskInstId
* @param pid pid
* @param appLinks appLinks
*/
public void updatePidByTaskInstId(int taskInstId, int pid,String appLinks) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskInstId);
taskInstance.setPid(pid);
taskInstance.setAppLink(appLinks);
saveTaskInstance(taskInstance);
}
/**
* query schedule by id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param id id
* @return schedule
*/
public Schedule querySchedule(int id) {
return scheduleMapper.selectById(id);
}
/**
* query Schedule by processDefinitionId
* @param processDefinitionId processDefinitionId
* @see Schedule
*/
public List<Schedule> queryReleaseSchedulerListByProcessDefinitionId(int processDefinitionId) {
return scheduleMapper.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId);
}
/**
* query need failover process instance
* @param host host
* @return process instance list
*/
public List<ProcessInstance> queryNeedFailoverProcessInstances(String host){
return processInstanceMapper.queryByHostAndStatus(host, stateArray);
}
/**
* process need failover process instance
* @param processInstance processInstance
*/
@Transactional(rollbackFor = Exception.class)
public void processNeedFailoverProcessInstances(ProcessInstance processInstance){
//
processInstance.setHost("null"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processInstanceMapper.updateById(processInstance);
//
Command cmd = new Command();
cmd.setProcessDefinitionId(processInstance.getProcessDefinitionId());
cmd.setCommandParam(String.format("{\"%s\":%d}", Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING, processInstance.getId()));
cmd.setExecutorId(processInstance.getExecutorId());
cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS);
createCommand(cmd);
}
/**
* query all need failover task instances by host
* @param host host
* @return task instance list
*/
public List<TaskInstance> queryNeedFailoverTaskInstances(String host){
return taskInstanceMapper.queryByHostAndStatus(host,
stateArray);
}
/**
* find data source by id
* @param id id
* @return datasource
*/
public DataSource findDataSourceById(int id){
return dataSourceMapper.selectById(id);
}
/**
* update process instance state by id
* @param processInstanceId processInstanceId
* @param executionStatus executionStatus |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @return update process result
*/
public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) {
ProcessInstance instance = processInstanceMapper.selectById(processInstanceId);
instance.setState(executionStatus);
return processInstanceMapper.updateById(instance);
}
/**
* find process instance by the task id
* @param taskId taskId
* @return process instance
*/
public ProcessInstance findProcessInstanceByTaskId(int taskId){
TaskInstance taskInstance = taskInstanceMapper.selectById(taskId);
if(taskInstance!= null){
return processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
}
return null;
}
/**
* find udf function list by id list string
* @param ids ids
* @return udf function list
*/
public List<UdfFunc> queryUdfFunListByids(int[] ids){
return udfFuncMapper.queryUdfByIdStr(ids, null);
}
/**
* find tenant code by resource name
* @param resName resource name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param resourceType resource type
* @return tenant code
*/
public String queryTenantCodeByResName(String resName,ResourceType resourceType){
return resourceMapper.queryTenantCodeByResourceName(resName, resourceType.ordinal());
}
/**
* find schedule list by process define id.
* @param ids ids
* @return schedule list
*/
public List<Schedule> selectAllByProcessDefineId(int[] ids){
return scheduleMapper.selectAllByProcessDefineArray(
ids);
}
/**
* get dependency cycle by work process define id and scheduler fire time
* @param masterId masterId
* @param processDefinitionId processDefinitionId
* @param scheduledFireTime the time the task schedule is expected to trigger
* @return CycleDependency
* @throws Exception if error throws Exception
*/
public CycleDependency getCycleDependency(int masterId, int processDefinitionId, Date scheduledFireTime) throws Exception {
List<CycleDependency> list = getCycleDependencies(masterId,new int[]{processDefinitionId},scheduledFireTime);
return list.size()>0 ? list.get(0) : null;
}
/**
* get dependency cycle list by work process define id list and scheduler fire time
* @param masterId masterId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param ids ids
* @param scheduledFireTime the time the task schedule is expected to trigger
* @return CycleDependency list
* @throws Exception if error throws Exception
*/
public List<CycleDependency> getCycleDependencies(int masterId,int[] ids,Date scheduledFireTime) throws Exception {
List<CycleDependency> cycleDependencyList = new ArrayList<CycleDependency>();
if(ArrayUtils.isEmpty(ids)){
logger.warn("ids[] is empty!is invalid!");
return cycleDependencyList;
}
if(scheduledFireTime == null){
logger.warn("scheduledFireTime is null!is invalid!");
return cycleDependencyList;
}
String strCrontab = "";
CronExpression depCronExpression;
Cron depCron;
List<Date> list;
List<Schedule> schedules = this.selectAllByProcessDefineId(ids);
//
for(Schedule depSchedule:schedules){
strCrontab = depSchedule.getCrontab();
depCronExpression = CronUtils.parse2CronExpression(strCrontab);
depCron = CronUtils.parse2Cron(strCrontab);
CycleEnum cycleEnum = CronUtils.getMiniCycle(depCron);
if(cycleEnum == null){
logger.error("{} is not valid",strCrontab);
continue;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | Calendar calendar = Calendar.getInstance();
switch (cycleEnum){
/*case MINUTE:
calendar.add(Calendar.MINUTE,-61);*/
case HOUR:
calendar.add(Calendar.HOUR,-25);
break;
case DAY:
calendar.add(Calendar.DATE,-32);
break;
case WEEK:
calendar.add(Calendar.DATE,-32);
break;
case MONTH:
calendar.add(Calendar.MONTH,-13);
break;
default:
logger.warn("Dependent process definition's cycleEnum is {},not support!!", cycleEnum.name());
continue;
}
Date start = calendar.getTime();
if(depSchedule.getProcessDefinitionId() == masterId){
list = CronUtils.getSelfFireDateList(start, scheduledFireTime, depCronExpression);
}else {
list = CronUtils.getFireDateList(start, scheduledFireTime, depCronExpression);
}
if(list.size()>=1){
start = list.get(list.size()-1);
CycleDependency dependency = new CycleDependency(depSchedule.getProcessDefinitionId(),start, CronUtils.getExpirationTime(start, cycleEnum), cycleEnum);
cycleDependencyList.add(dependency); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
}
return cycleDependencyList;
}
/**
* find last scheduler process instance in the date interval
* @param definitionId definitionId
* @param dateInterval dateInterval
* @return process instance
*/
public ProcessInstance findLastSchedulerProcessInterval(int definitionId, DateInterval dateInterval) {
return processInstanceMapper.queryLastSchedulerProcess(definitionId,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/**
* find last manual process instance interval
* @param definitionId process definition id
* @param dateInterval dateInterval
* @return process instance
*/
public ProcessInstance findLastManualProcessInterval(int definitionId, DateInterval dateInterval) {
return processInstanceMapper.queryLastManualProcess(definitionId,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/**
* find last running process instance
* @param definitionId process definition id
* @param startTime start time |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param endTime end time
* @return process instance
*/
public ProcessInstance findLastRunningProcess(int definitionId, Date startTime, Date endTime) {
return processInstanceMapper.queryLastRunningProcess(definitionId,
startTime,
endTime,
stateArray);
}
/**
* query user queue by process instance id
* @param processInstanceId processInstanceId
* @return queue
*/
public String queryUserQueueByProcessInstanceId(int processInstanceId){
String queue = "";
ProcessInstance processInstance = processInstanceMapper.selectById(processInstanceId);
if(processInstance == null){
return queue;
}
User executor = userMapper.selectById(processInstance.getExecutorId());
if(executor != null){
queue = executor.getQueue();
}
return queue;
}
/**
* get task worker group
* @param taskInstance taskInstance
* @return workerGroupId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public String getTaskWorkerGroup(TaskInstance taskInstance) {
String workerGroup = taskInstance.getWorkerGroup();
if(StringUtils.isNotBlank(workerGroup)){
return workerGroup;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if(processInstance != null){
return processInstance.getWorkerGroup();
}
logger.info("task : {} will use default worker group", taskInstance.getId());
return Constants.DEFAULT_WORKER_GROUP;
}
/**
* get have perm project list
* @param userId userId
* @return project list
*/
public List<Project> getProjectListHavePerm(int userId){
List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId);
List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId);
if(createProjects == null){
createProjects = new ArrayList<>();
}
if(authedProjects != null){
createProjects.addAll(authedProjects);
}
return createProjects;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | /**
* get have perm project ids
* @param userId userId
* @return project ids
*/
public List<Integer> getProjectIdListHavePerm(int userId){
List<Integer> projectIdList = new ArrayList<>();
for(Project project : getProjectListHavePerm(userId)){
projectIdList.add(project.getId());
}
return projectIdList;
}
/**
* list unauthorized udf function
* @param userId user id
* @param needChecks data source id array
* @return unauthorized udf function list
*/
public <T> List<T> listUnauthorized(int userId,T[] needChecks,AuthorizationType authorizationType){
List<T> resultList = new ArrayList<T>();
if (!ArrayUtils.isEmpty(needChecks)) {
Set<T> originResSet = new HashSet<T>(Arrays.asList(needChecks));
switch (authorizationType){
case RESOURCE_FILE_ID:
Set<Integer> authorizedResourceFiles = resourceMapper.listAuthorizedResourceById(userId, needChecks).stream().map(t -> t.getId()).collect(toSet());
originResSet.removeAll(authorizedResourceFiles);
break;
case RESOURCE_FILE_NAME:
Set<String> authorizedResources = resourceMapper.listAuthorizedResource(userId, needChecks).stream().map(t -> t.getFullName()).collect(toSet());
originResSet.removeAll(authorizedResources); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | break;
case UDF_FILE:
Set<Integer> authorizedUdfFiles = resourceMapper.listAuthorizedResourceById(userId, needChecks).stream().map(t -> t.getId()).collect(toSet());
originResSet.removeAll(authorizedUdfFiles);
break;
case DATASOURCE:
Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId,needChecks).stream().map(t -> t.getId()).collect(toSet());
originResSet.removeAll(authorizedDatasources);
break;
case UDF:
Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(t -> t.getId()).collect(toSet());
originResSet.removeAll(authorizedUdfs);
break;
}
resultList.addAll(originResSet);
}
return resultList;
}
/**
* get user by user id
* @param userId user id
* @return User
*/
public User getUserById(int userId){
return userMapper.queryDetailsById(userId);
}
/**
* get resource by resoruce id
* @param resoruceId resource id
* @return Resource |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,464 | [BUG] dependent task failed when conditions task exists | 
description:
1. work flow A have a conditions task.
2. work flow B have a dependent task that depend work A
3. work flow B would failed always.
| https://github.com/apache/dolphinscheduler/issues/2464 | https://github.com/apache/dolphinscheduler/pull/2768 | 7a05c007b45ea742e3ed1a7558c1a641515c140c | 184d64e85291b1e8fb82494bf5a8e2ea755a3dc1 | "2020-04-20T02:48:35Z" | java | "2020-05-21T02:34:28Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public Resource getResourceById(int resoruceId){
return resourceMapper.selectById(resoruceId);
}
/**
* list resources by ids
* @param resIds resIds
* @return resource list
*/
public List<Resource> listResourceByIds(Integer[] resIds){
return resourceMapper.listResourceByIds(resIds);
}
/**
* format task app id in task instance
* @param taskInstance
* @return
*/
public String formatTaskAppId(TaskInstance taskInstance){
ProcessDefinition definition = this.findProcessDefineById(taskInstance.getProcessDefinitionId());
ProcessInstance processInstanceById = this.findProcessInstanceById(taskInstance.getProcessInstanceId());
if(definition == null || processInstanceById == null){
return "";
}
return String.format("%s_%s_%s",
definition.getId(),
processInstanceById.getId(),
taskInstance.getId());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import com.alibaba.fastjson.JSON;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.DataType;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.PlaceholderUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.TimePlaceholderUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.util.*;
/**
* parameter parse utils
*/
public class ParameterUtils {
private static final Logger logger = LoggerFactory.getLogger(ParameterUtils.class);
/**
* convert parameters place holders
*
* @param parameterString parameter
* @param parameterMap parameter map
* @return convert parameters place holders |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | */
public static String convertParameterPlaceholders(String parameterString, Map<String, String> parameterMap) {
if (StringUtils.isEmpty(parameterString)) {
return parameterString;
}
String cronTimeStr = parameterMap.get(Constants.PARAMETER_DATETIME);
Date cronTime = null;
if (StringUtils.isNotEmpty(cronTimeStr)) {
try {
cronTime = DateUtils.parseDate(cronTimeStr, new String[]{Constants.PARAMETER_FORMAT_TIME});
} catch (ParseException e) {
logger.error("parse {} exception", cronTimeStr, e);
}
} else {
cronTime = new Date();
}
parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
if (cronTime != null) {
parameterString = TimePlaceholderUtils.replacePlaceholders(parameterString, cronTime, true);
}
return parameterString;
}
/**
* new
* convert parameters place holders
*
* @param parameterString parameter |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | * @param parameterMap parameter map
* @return convert parameters place holders
*/
public static String convertParameterPlaceholders2(String parameterString, Map<String, String> parameterMap) {
if (StringUtils.isEmpty(parameterString)) {
return parameterString;
}
String cronTimeStr = parameterMap.get(Constants.PARAMETER_SHECDULE_TIME);
Date cronTime = null;
if (StringUtils.isNotEmpty(cronTimeStr)) {
try {
cronTime = DateUtils.parseDate(cronTimeStr, new String[]{Constants.PARAMETER_FORMAT_TIME});
} catch (ParseException e) {
logger.error(String.format("parse %s exception", cronTimeStr), e);
}
} else {
cronTime = new Date();
}
parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
if (cronTime != null) {
parameterString = TimePlaceholderUtils.replacePlaceholders(parameterString, cronTime, true);
}
return parameterString;
}
/**
* set in parameter
* @param index index |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | * @param stmt preparedstatement
* @param dataType data type
* @param value value
* @throws Exception errors
*/
public static void setInParameter(int index, PreparedStatement stmt, DataType dataType, String value)throws Exception{
if (dataType.equals(DataType.VARCHAR)){
stmt.setString(index,value);
}else if (dataType.equals(DataType.INTEGER)){
stmt.setInt(index, Integer.parseInt(value));
}else if (dataType.equals(DataType.LONG)){
stmt.setLong(index, Long.parseLong(value));
}else if (dataType.equals(DataType.FLOAT)){
stmt.setFloat(index, Float.parseFloat(value));
}else if (dataType.equals(DataType.DOUBLE)){
stmt.setDouble(index, Double.parseDouble(value));
}else if (dataType.equals(DataType.DATE)){
stmt.setDate(index, java.sql.Date.valueOf(value));
}else if (dataType.equals(DataType.TIME)){
stmt.setString(index, value);
}else if (dataType.equals(DataType.TIMESTAMP)){
stmt.setTimestamp(index, java.sql.Timestamp.valueOf(value));
}else if (dataType.equals(DataType.BOOLEAN)){
stmt.setBoolean(index,Boolean.parseBoolean(value));
}
}
/**
* curing user define parameters
*
* @param globalParamMap global param map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | * @param globalParamList global param list
* @param commandType command type
* @param scheduleTime schedule time
* @return curing user define parameters
*/
public static String curingGlobalParams(Map<String,String> globalParamMap, List<Property> globalParamList,
CommandType commandType, Date scheduleTime){
if (globalParamList == null || globalParamList.isEmpty()) {
return null;
}
Map<String, String> globalMap = new HashMap<>();
if (globalParamMap!= null){
globalMap.putAll(globalParamMap);
}
Map<String,String> allParamMap = new HashMap<>();
Map<String,String> timeParams = BusinessTimeUtils
.getBusinessTime(commandType, scheduleTime);
if (timeParams != null) {
allParamMap.putAll(timeParams);
}
allParamMap.putAll(globalMap);
Set<Map.Entry<String, String>> entries = allParamMap.entrySet();
Map<String,String> resolveMap = new HashMap<>();
for (Map.Entry<String,String> entry : entries){
String val = entry.getValue();
if (val.startsWith("$")){
String str = ParameterUtils.convertParameterPlaceholders(val, allParamMap);
resolveMap.put(entry.getKey(),str);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | }
globalMap.putAll(resolveMap);
for (Property property : globalParamList){
String val = globalMap.get(property.getProp());
if (val != null){
property.setValue(val);
}
}
return JSON.toJSONString(globalParamList);
}
/**
* handle escapes
* @param inputString input string
* @return string filter escapes
*/
public static String handleEscapes(String inputString){
if(StringUtils.isNotEmpty(inputString)){
return inputString.replace("%", "////%");
}
return inputString;
}
/**
* new
* $[yyyyMMdd] replace scheduler time
* @param text
* @param paramsMap
* @return
*/
public static String replaceScheduleTime(String text, Date scheduleTime, Map<String, Property> paramsMap) {
if (paramsMap != null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java | if (null == scheduleTime) {
scheduleTime = new Date();
}
String dateTime = org.apache.dolphinscheduler.common.utils.DateUtils.format(scheduleTime, Constants.PARAMETER_FORMAT_TIME);
Property p = new Property();
p.setValue(dateTime);
p.setProp(Constants.PARAMETER_SHECDULE_TIME);
paramsMap.put(Constants.PARAMETER_SHECDULE_TIME, p);
text = ParameterUtils.convertParameterPlaceholders2(text, convert(paramsMap));
}
return text;
}
/**
* format convert
* @param paramsMap params map
* @return Map of converted
* see org.apache.dolphinscheduler.server.utils.ParamUtils.convert
*/
public static Map<String,String> convert(Map<String,Property> paramsMap){
Map<String,String> map = new HashMap<>();
Iterator<Map.Entry<String, Property>> iter = paramsMap.entrySet().iterator();
while (iter.hasNext()){
Map.Entry<String, Property> en = iter.next();
map.put(en.getKey(),en.getValue().getValue());
}
return map;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.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.worker.task.sql;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang.StringUtils;
import org.apache.dolphinscheduler.alert.utils.MailUtils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.*;
import org.apache.dolphinscheduler.common.enums.DbType;
import org.apache.dolphinscheduler.common.enums.ShowType;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlBinds; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlType;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource;
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.server.entity.SQLTaskExecutionContext;
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.server.utils.ParamUtils;
import org.apache.dolphinscheduler.server.utils.UDFUtils;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import java.sql.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.apache.dolphinscheduler.common.Constants.*;
import static org.apache.dolphinscheduler.common.enums.DbType.HIVE;
/**
* sql task
*/
public class SqlTask extends AbstractTask {
/**
* sql parameters
*/
private SqlParameters sqlParameters;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | * alert dao
*/
private AlertDao alertDao;
/**
* base datasource
*/
private BaseDataSource baseDataSource;
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* default query sql limit
*/
private static final int LIMIT = 10000;
public SqlTask(TaskExecutionContext taskExecutionContext, Logger logger) {
super(taskExecutionContext, logger);
this.taskExecutionContext = taskExecutionContext;
logger.info("sql task params {}", taskExecutionContext.getTaskParams());
this.sqlParameters = JSONObject.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class);
if (!sqlParameters.checkParameters()) {
throw new RuntimeException("sql task params is not valid");
}
this.alertDao = SpringApplicationContext.getBean(AlertDao.class);
}
@Override
public void handle() throws Exception {
String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, taskExecutionContext.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | logger.info("Full sql parameters: {}", sqlParameters);
logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {}",
sqlParameters.getType(),
sqlParameters.getDatasource(),
sqlParameters.getSql(),
sqlParameters.getLocalParams(),
sqlParameters.getUdfs(),
sqlParameters.getShowType(),
sqlParameters.getConnParams());
try {
SQLTaskExecutionContext sqlTaskExecutionContext = taskExecutionContext.getSqlTaskExecutionContext();
DataSourceFactory.loadClass(DbType.valueOf(sqlParameters.getType()));
baseDataSource = DataSourceFactory.getDatasource(DbType.valueOf(sqlParameters.getType()),
sqlTaskExecutionContext.getConnectionParams());
SqlBinds mainSqlBinds = getSqlAndSqlParamsMap(sqlParameters.getSql());
List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<String> createFuncs = UDFUtils.createFuncs(sqlTaskExecutionContext.getUdfFuncList(),
taskExecutionContext.getTenantCode(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | logger);
executeFuncAndSql(mainSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs);
setExitStatusCode(Constants.EXIT_CODE_SUCCESS);
} catch (Exception e) {
setExitStatusCode(Constants.EXIT_CODE_FAILURE);
logger.error("sql task error", e);
throw e;
}
}
/**
* ready to execute SQL and parameter entity Map
* @return
*/
private SqlBinds getSqlAndSqlParamsMap(String sql) {
Map<Integer,Property> sqlParamsMap = new HashMap<>();
StringBuilder sqlBuilder = new StringBuilder();
Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()),
taskExecutionContext.getDefinedParams(),
sqlParameters.getLocalParametersMap(),
CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
taskExecutionContext.getScheduleTime());
if(paramsMap == null){
sqlBuilder.append(sql);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
if (StringUtils.isNotEmpty(sqlParameters.getTitle())){
String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | ParamUtils.convert(paramsMap));
logger.info("SQL title : {}",title);
sqlParameters.setTitle(title);
}
sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap);
String rgex = "['\"]*\\$\\{(.*?)\\}['\"]*";
setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap);
String formatSql = sql.replaceAll(rgex, "?");
sqlBuilder.append(formatSql);
printReplacedSql(sql, formatSql, rgex, sqlParamsMap);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
@Override
public AbstractParameters getParameters() {
return this.sqlParameters;
}
/**
* execute function and sql
* @param mainSqlBinds main sql binds
* @param preStatementsBinds pre statements binds
* @param postStatementsBinds post statements binds
* @param createFuncs create functions
*/
public void executeFuncAndSql(SqlBinds mainSqlBinds,
List<SqlBinds> preStatementsBinds, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | List<SqlBinds> postStatementsBinds,
List<String> createFuncs){
Connection connection = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
try {
CommonUtils.loadKerberosConf();
connection = createConnection();
if (CollectionUtils.isNotEmpty(createFuncs)) {
createTempFunction(connection,createFuncs);
}
preSql(connection,preStatementsBinds);
stmt = prepareStatementAndBind(connection, mainSqlBinds);
if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) {
resultSet = stmt.executeQuery();
resultProcess(resultSet);
} else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) {
stmt.executeUpdate();
}
postSql(connection,postStatementsBinds);
} catch (Exception e) {
logger.error("execute sql error",e);
throw new RuntimeException("execute sql error"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | } finally {
close(resultSet,stmt,connection);
}
}
/**
* result process
*
* @param resultSet resultSet
* @throws Exception
*/
private void resultProcess(ResultSet resultSet) throws Exception{
JSONArray resultJSONArray = new JSONArray();
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount();
int rowCount = 0;
while (rowCount < LIMIT && resultSet.next()) {
JSONObject mapOfColValues = new JSONObject(true);
for (int i = 1; i <= num; i++) {
mapOfColValues.put(md.getColumnName(i), resultSet.getObject(i));
}
resultJSONArray.add(mapOfColValues);
rowCount++;
}
logger.debug("execute sql : {}", JSONObject.toJSONString(resultJSONArray, SerializerFeature.WriteMapNullValue));
if (!resultJSONArray.isEmpty() ) {
if (StringUtils.isNotEmpty(sqlParameters.getTitle())) {
sendAttachment(sqlParameters.getTitle(),
JSONObject.toJSONString(resultJSONArray, SerializerFeature.WriteMapNullValue));
}else{ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | sendAttachment(taskExecutionContext.getTaskName() + " query resultsets ",
JSONObject.toJSONString(resultJSONArray, SerializerFeature.WriteMapNullValue));
}
}
}
/**
* pre sql
*
* @param connection connection
* @param preStatementsBinds preStatementsBinds
*/
private void preSql(Connection connection,
List<SqlBinds> preStatementsBinds) throws Exception{
for (SqlBinds sqlBind: preStatementsBinds) {
try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)){
int result = pstmt.executeUpdate();
logger.info("pre statement execute result: {}, for sql: {}",result,sqlBind.getSql());
}
}
}
/**
* post psql
*
* @param connection connection
* @param postStatementsBinds postStatementsBinds
* @throws Exception
*/
private void postSql(Connection connection,
List<SqlBinds> postStatementsBinds) throws Exception{
for (SqlBinds sqlBind: postStatementsBinds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)){
int result = pstmt.executeUpdate();
logger.info("post statement execute result: {},for sql: {}",result,sqlBind.getSql());
}
}
}
/**
* create temp function
*
* @param connection connection
* @param createFuncs createFuncs
* @throws Exception
*/
private void createTempFunction(Connection connection,
List<String> createFuncs) throws Exception{
try (Statement funcStmt = connection.createStatement()) {
for (String createFunc : createFuncs) {
logger.info("hive create function sql: {}", createFunc);
funcStmt.execute(createFunc);
}
}
}
/**
* create connection
*
* @return connection
* @throws Exception
*/
private Connection createConnection() throws Exception{ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | Connection connection = null;
if (HIVE == DbType.valueOf(sqlParameters.getType())) {
Properties paramProp = new Properties();
paramProp.setProperty(USER, baseDataSource.getUser());
paramProp.setProperty(PASSWORD, baseDataSource.getPassword());
Map<String, String> connParamMap = CollectionUtils.stringToMap(sqlParameters.getConnParams(),
SEMICOLON,
HIVE_CONF);
paramProp.putAll(connParamMap);
connection = DriverManager.getConnection(baseDataSource.getJdbcUrl(),
paramProp);
}else{
connection = DriverManager.getConnection(baseDataSource.getJdbcUrl(),
baseDataSource.getUser(),
baseDataSource.getPassword());
}
return connection;
}
/**
* close jdbc resource
*
* @param resultSet resultSet
* @param pstmt pstmt
* @param connection connection
*/
private void close(ResultSet resultSet,
PreparedStatement pstmt,
Connection connection){
if (resultSet != null){
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | connection.close();
} catch (SQLException e) {
}
}
if (pstmt != null){
try {
connection.close();
} catch (SQLException e) {
}
}
if (connection != null){
try {
connection.close();
} catch (SQLException e) {
}
}
}
/**
* preparedStatement bind
* @param connection
* @param sqlBinds
* @return
* @throws Exception
*/
private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) throws Exception {
boolean timeoutFlag = TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.FAILED ||
TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.WARNFAILED;
PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
if(timeoutFlag){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout());
}
Map<Integer, Property> params = sqlBinds.getParamsMap();
if(params != null) {
for (Map.Entry<Integer, Property> entry : params.entrySet()) {
Property prop = entry.getValue();
ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue());
}
}
logger.info("prepare statement replace sql : {} ", stmt);
return stmt;
}
/**
* send mail as an attachment
* @param title title
* @param content content
*/
public void sendAttachment(String title,String content){
List<User> users = alertDao.queryUserByAlertGroupId(taskExecutionContext.getSqlTaskExecutionContext().getWarningGroupId());
List<String> receviersList = new ArrayList<>();
for(User user:users){
receviersList.add(user.getEmail().trim());
}
String receivers = sqlParameters.getReceivers();
if (StringUtils.isNotEmpty(receivers)){
String[] splits = receivers.split(COMMA);
for (String receiver : splits){
receviersList.add(receiver.trim()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
}
List<String> receviersCcList = new ArrayList<>();
String receiversCc = sqlParameters.getReceiversCc();
if (StringUtils.isNotEmpty(receiversCc)){
String[] splits = receiversCc.split(COMMA);
for (String receiverCc : splits){
receviersCcList.add(receiverCc.trim());
}
}
String showTypeName = sqlParameters.getShowType().replace(COMMA,"").trim();
if(EnumUtils.isValidEnum(ShowType.class,showTypeName)){
Map<String, Object> mailResult = MailUtils.sendMails(receviersList,
receviersCcList, title, content, ShowType.valueOf(showTypeName).getDescp());
if(!(boolean) mailResult.get(STATUS)){
throw new RuntimeException("send mail failed!");
}
}else{
logger.error("showType: {} is not valid " ,showTypeName);
throw new RuntimeException(String.format("showType: %s is not valid ",showTypeName));
}
}
/**
* regular expressions match the contents between two specified strings
* @param content content
* @param rgex rgex
* @param sqlParamsMap sql params map
* @param paramsPropsMap params props map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,739 | [BUG] SQLTask replace the ${} of the SQL statement to "?" does not work | **Describe the bug**
In the SqlTask
the function ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime(), paramsMap) replaces all $ {} to real value, so the function setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap); does not work
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2739 | https://github.com/apache/dolphinscheduler/pull/2741 | cfd83235a29ec9e19f3c87a27e7d77edf3381c63 | 6d0375e46d07f386125a3c6e091e605a515df03d | "2020-05-18T07:56:57Z" | java | "2020-05-21T08:09:36Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | */
public void setSqlParamsMap(String content, String rgex, Map<Integer,Property> sqlParamsMap, Map<String,Property> paramsPropsMap){
Pattern pattern = Pattern.compile(rgex);
Matcher m = pattern.matcher(content);
int index = 1;
while (m.find()) {
String paramName = m.group(1);
Property prop = paramsPropsMap.get(paramName);
sqlParamsMap.put(index,prop);
index ++;
}
}
/**
* print replace sql
* @param content content
* @param formatSql format sql
* @param rgex rgex
* @param sqlParamsMap sql params map
*/
public void printReplacedSql(String content, String formatSql,String rgex, Map<Integer,Property> sqlParamsMap){
logger.info("after replace sql , preparing : {}" , formatSql);
StringBuilder logPrint = new StringBuilder("replaced sql , parameters:");
for(int i=1;i<=sqlParamsMap.size();i++){
logPrint.append(sqlParamsMap.get(i).getValue()+"("+sqlParamsMap.get(i).getType()+")");
}
logger.info("Sql Params are {}", logPrint);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import java.util.regex.Pattern;
/**
* Constants
*/
public final class Constants { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | private Constants() {
throw new IllegalStateException("Constants class");
}
/**
* quartz config
*/
public static final String ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS = "org.quartz.jobStore.driverDelegateClass";
public static final String ORG_QUARTZ_SCHEDULER_INSTANCENAME = "org.quartz.scheduler.instanceName";
public static final String ORG_QUARTZ_SCHEDULER_INSTANCEID = "org.quartz.scheduler.instanceId";
public static final String ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON = "org.quartz.scheduler.makeSchedulerThreadDaemon";
public static final String ORG_QUARTZ_JOBSTORE_USEPROPERTIES = "org.quartz.jobStore.useProperties"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String ORG_QUARTZ_THREADPOOL_CLASS = "org.quartz.threadPool.class";
public static final String ORG_QUARTZ_THREADPOOL_THREADCOUNT = "org.quartz.threadPool.threadCount";
public static final String ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS = "org.quartz.threadPool.makeThreadsDaemons";
public static final String ORG_QUARTZ_THREADPOOL_THREADPRIORITY = "org.quartz.threadPool.threadPriority";
public static final String ORG_QUARTZ_JOBSTORE_CLASS = "org.quartz.jobStore.class";
public static final String ORG_QUARTZ_JOBSTORE_TABLEPREFIX = "org.quartz.jobStore.tablePrefix";
public static final String ORG_QUARTZ_JOBSTORE_ISCLUSTERED = "org.quartz.jobStore.isClustered";
public static final String ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD = "org.quartz.jobStore.misfireThreshold";
public static final String ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL = "org.quartz.jobStore.clusterCheckinInterval";
public static final String ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK = "org.quartz.jobStore.acquireTriggersWithinLock";
public static final String ORG_QUARTZ_JOBSTORE_DATASOURCE = "org.quartz.jobStore.dataSource";
public static final String ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS = "org.quartz.dataSource.myDs.connectionProvider.class";
/**
* quartz config default value
*/
public static final String QUARTZ_TABLE_PREFIX = "QRTZ_";
public static final String QUARTZ_MISFIRETHRESHOLD = "60000";
public static final String QUARTZ_CLUSTERCHECKININTERVAL = "5000";
public static final String QUARTZ_DATASOURCE = "myDs";
public static final String QUARTZ_THREADCOUNT = "25";
public static final String QUARTZ_THREADPRIORITY = "5";
public static final String QUARTZ_INSTANCENAME = "DolphinScheduler";
public static final String QUARTZ_INSTANCEID = "AUTO";
public static final String QUARTZ_ACQUIRETRIGGERSWITHINLOCK = "true";
/**
* common properties path
*/
public static final String COMMON_PROPERTIES_PATH = "/common.properties";
/**
* fs.defaultFS |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | */
public static final String FS_DEFAULTFS = "fs.defaultFS";
/**
* fs s3a endpoint
*/
public static final String FS_S3A_ENDPOINT = "fs.s3a.endpoint";
/**
* fs s3a access key
*/
public static final String FS_S3A_ACCESS_KEY = "fs.s3a.access.key";
/**
* fs s3a secret key
*/
public static final String FS_S3A_SECRET_KEY = "fs.s3a.secret.key";
/**
* yarn.resourcemanager.ha.rm.ids
*/
public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids";
public static final String YARN_RESOURCEMANAGER_HA_XX = "xx";
/**
* yarn.application.status.address
*/
public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address";
/**
* hdfs configuration
* hdfs.root.user
*/
public static final String HDFS_ROOT_USER = "hdfs.root.user";
/**
* hdfs/s3 configuration |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * resource.upload.path
*/
public static final String RESOURCE_UPLOAD_PATH = "resource.upload.path";
/**
* data basedir path
*/
public static final String DATA_BASEDIR_PATH = "data.basedir.path";
/**
* dolphinscheduler.env.path
*/
public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path";
/**
* environment properties default path
*/
public static final String ENV_PATH = "env/dolphinscheduler_env.sh";
/**
* python home
*/
public static final String PYTHON_HOME="PYTHON_HOME";
/**
* resource.view.suffixs
*/
public static final String RESOURCE_VIEW_SUFFIXS = "resource.view.suffixs";
public static final String RESOURCE_VIEW_SUFFIXS_DEFAULT_VALUE = "txt,log,sh,conf,cfg,py,java,sql,hql,xml,properties";
/**
* development.state
*/
public static final String DEVELOPMENT_STATE = "development.state";
public static final String DEVELOPMENT_STATE_DEFAULT_VALUE = "true";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * string true
*/
public static final String STRING_TRUE = "true";
/**
* string false
*/
public static final String STRING_FALSE = "false";
/**
* resource storage type
*/
public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type";
/**
* MasterServer directory registered in zookeeper
*/
public static final String ZOOKEEPER_DOLPHINSCHEDULER_MASTERS = "/nodes/master";
/**
* WorkerServer directory registered in zookeeper
*/
public static final String ZOOKEEPER_DOLPHINSCHEDULER_WORKERS = "/nodes/worker";
/**
* all servers directory registered in zookeeper
*/
public static final String ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers";
/**
* MasterServer lock directory registered in zookeeper
*/
public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters";
/**
* MasterServer failover directory registered in zookeeper
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters";
/**
* WorkerServer failover directory registered in zookeeper
*/
public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers";
/**
* MasterServer startup failover runing and fault tolerance process
*/
public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters";
/**
* comma ,
*/
public static final String COMMA = ",";
/**
* slash /
*/
public static final String SLASH = "/";
/**
* COLON :
*/
public static final String COLON = ":";
/**
* SINGLE_SLASH /
*/
public static final String SINGLE_SLASH = "/";
/**
* DOUBLE_SLASH //
*/
public static final String DOUBLE_SLASH = "//";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * SEMICOLON ;
*/
public static final String SEMICOLON = ";";
/**
* EQUAL SIGN
*/
public static final String EQUAL_SIGN = "=";
public static final String WORKER_MAX_CPULOAD_AVG = "worker.max.cpuload.avg";
public static final String WORKER_RESERVED_MEMORY = "worker.reserved.memory";
public static final String MASTER_MAX_CPULOAD_AVG = "master.max.cpuload.avg";
public static final String MASTER_RESERVED_MEMORY = "master.reserved.memory";
/**
* date format of yyyy-MM-dd HH:mm:ss
*/
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
/**
* date format of yyyyMMddHHmmss
*/
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
/**
* http connect time out
*/
public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000;
/**
* http connect request time out
*/
public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000;
/**
* httpclient soceket time out
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final int SOCKET_TIMEOUT = 60 * 1000;
/**
* http header
*/
public static final String HTTP_HEADER_UNKNOWN = "unKnown";
/**
* http X-Forwarded-For
*/
public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For";
/**
* http X-Real-IP
*/
public static final String HTTP_X_REAL_IP = "X-Real-IP";
/**
* UTF-8
*/
public static final String UTF_8 = "UTF-8";
/**
* user name regex
*/
public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,20}$");
/**
* email regex
*/
public static final Pattern REGEX_MAIL_NAME = Pattern.compile("^([a-z0-9A-Z]+[_|\\-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$");
/**
* read permission
*/
public static final int READ_PERMISSION = 2 * 1;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * write permission
*/
public static final int WRITE_PERMISSION = 2 * 2;
/**
* execute permission
*/
public static final int EXECUTE_PERMISSION = 1;
/**
* default admin permission
*/
public static final int DEFAULT_ADMIN_PERMISSION = 7;
/**
* all permissions
*/
public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION;
/**
* max task timeout
*/
public static final int MAX_TASK_TIMEOUT = 24 * 3600;
/**
* master cpu load
*/
public static final int DEFAULT_MASTER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2;
/**
* master reserved memory
*/
public static final double DEFAULT_MASTER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10;
/**
* worker cpu load
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final int DEFAULT_WORKER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2;
/**
* worker reserved memory
*/
public static final double DEFAULT_WORKER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10;
/**
* default log cache rows num,output when reach the number
*/
public static final int DEFAULT_LOG_ROWS_NUM = 4 * 16;
/**
* log flush interval?output when reach the interval
*/
public static final int DEFAULT_LOG_FLUSH_INTERVAL = 1000;
/**
* time unit secong to minutes
*/
public static final int SEC_2_MINUTES_TIME_UNIT = 60;
/***
*
* rpc port
*/
public static final int RPC_PORT = 50051;
/**
* forbid running task
*/
public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN";
/**
* datasource configuration path
*/
public static final String DATASOURCE_PROPERTIES = "/datasource.properties"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String TASK_RECORD_URL = "task.record.datasource.url";
public static final String TASK_RECORD_FLAG = "task.record.flag";
public static final String TASK_RECORD_USER = "task.record.datasource.username";
public static final String TASK_RECORD_PWD = "task.record.datasource.password";
public static final String DEFAULT = "Default";
public static final String USER = "user";
public static final String PASSWORD = "password";
public static final String XXXXXX = "******";
public static final String NULL = "NULL";
public static final String THREAD_NAME_MASTER_SERVER = "Master-Server";
public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server";
public static final String TASK_RECORD_TABLE_HIVE_LOG = "eamp_hive_log_hd";
public static final String TASK_RECORD_TABLE_HISTORY_HIVE_LOG = "eamp_hive_hist_log_hd";
/**
* command parameter keys
*/
public static final String CMDPARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId";
public static final String CMDPARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList";
public static final String CMDPARAM_RECOVERY_WAITTING_THREAD = "WaittingThreadInstanceId";
public static final String CMDPARAM_SUB_PROCESS = "processInstanceId";
public static final String CMDPARAM_EMPTY_SUB_PROCESS = "0";
public static final String CMDPARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId";
public static final String CMDPARAM_SUB_PROCESS_DEFINE_ID = "processDefinitionId";
public static final String CMDPARAM_START_NODE_NAMES = "StartNodeNameList";
/**
* complement data start date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate";
/**
* complement data end date |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,735 | [BUG]The IP and process pid of the master and worker in the monitoring center are not displayed |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2735 | https://github.com/apache/dolphinscheduler/pull/2770 | 3d857bba925348f4b92b9ba857c37fbca28549dd | 396b1716e4e9b0f55f3686ba8e0283555c65c085 | "2020-05-18T06:14:37Z" | java | "2020-05-22T03:20:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | */
public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate";
/**
* hadoop configuration
*/
public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE";
public static final String HADOOP_RM_STATE_STANDBY = "STANDBY";
public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port";
/**
* data source config
*/
public static final String SPRING_DATASOURCE_DRIVER_CLASS_NAME = "spring.datasource.driver-class-name";
public static final String SPRING_DATASOURCE_URL = "spring.datasource.url";
public static final String SPRING_DATASOURCE_USERNAME = "spring.datasource.username";
public static final String SPRING_DATASOURCE_PASSWORD = "spring.datasource.password";
public static final String SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT = "spring.datasource.validationQueryTimeout";
public static final String SPRING_DATASOURCE_INITIAL_SIZE = "spring.datasource.initialSize";
public static final String SPRING_DATASOURCE_MIN_IDLE = "spring.datasource.minIdle";
public static final String SPRING_DATASOURCE_MAX_ACTIVE = "spring.datasource.maxActive";
public static final String SPRING_DATASOURCE_MAX_WAIT = "spring.datasource.maxWait";
public static final String SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS = "spring.datasource.timeBetweenEvictionRunsMillis";
public static final String SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS = "spring.datasource.timeBetweenConnectErrorMillis";
public static final String SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS = "spring.datasource.minEvictableIdleTimeMillis";
public static final String SPRING_DATASOURCE_VALIDATION_QUERY = "spring.datasource.validationQuery";
public static final String SPRING_DATASOURCE_TEST_WHILE_IDLE = "spring.datasource.testWhileIdle";
public static final String SPRING_DATASOURCE_TEST_ON_BORROW = "spring.datasource.testOnBorrow";
public static final String SPRING_DATASOURCE_TEST_ON_RETURN = "spring.datasource.testOnReturn";
public static final String SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS = "spring.datasource.poolPreparedStatements";
public static final String SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT = "spring.datasource.defaultAutoCommit";
public static final String SPRING_DATASOURCE_KEEP_ALIVE = "spring.datasource.keepAlive"; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.