Skip to content

Commit

Permalink
[DS-14566][master] fix serial_wait command_param does not replace glo…
Browse files Browse the repository at this point in the history
…bal_params (#14606)

This closes #14566

Co-authored-by: yangxin3 <[email protected]>
Co-authored-by: Eric Gao <[email protected]>
Co-authored-by: xiangzihao <[email protected]>
  • Loading branch information
4 people authored Jul 25, 2023
1 parent 1641544 commit 4a80e3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import org.apache.dolphinscheduler.service.utils.DagHelper;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;

Expand Down Expand Up @@ -784,6 +785,16 @@ public void checkSerialProcess(ProcessDefinition processDefinition) {
return;
}
Map<String, Object> cmdParam = new HashMap<>();
// write the parameters of the nextProcessInstance to command
if (StringUtils.isNotEmpty(nextProcessInstance.getCommandParam())) {
Map<String, String> commandStartParamsMap = JSONUtils.toMap(nextProcessInstance.getCommandParam());
if (MapUtils.isNotEmpty(commandStartParamsMap)) {
Map<String, String> paramsMap = JSONUtils.toMap(commandStartParamsMap.get(CMD_PARAM_START_PARAMS));
if (MapUtils.isNotEmpty(paramsMap)) {
cmdParam.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(paramsMap));
}
}
}
cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, nextInstanceId);
Command command = new Command();
command.setCommandType(CommandType.RECOVER_SERIAL_WAIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ private Boolean checkCmdParam(Command command, Map<String, String> cmdParam) {
* @param host host
* @return process instance
*/
@Override
public @Nullable ProcessInstance constructProcessInstance(Command command,
String host) throws CronParseException, CodeGenerateException {
ProcessInstance processInstance;
Expand Down Expand Up @@ -774,7 +775,8 @@ private Boolean checkCmdParam(Command command, Map<String, String> cmdParam) {
CommandType commandTypeIfComplement = getCommandTypeIfComplement(processInstance, command);
// reset global params while repeat running and recover tolerance fault process is needed by cmdParam
if (commandTypeIfComplement == CommandType.REPEAT_RUNNING ||
commandTypeIfComplement == CommandType.RECOVER_TOLERANCE_FAULT_PROCESS) {
commandTypeIfComplement == CommandType.RECOVER_TOLERANCE_FAULT_PROCESS ||
commandTypeIfComplement == CommandType.RECOVER_SERIAL_WAIT) {
setGlobalParamIfCommanded(processDefinition, cmdParam);
}

Expand Down

0 comments on commit 4a80e3a

Please sign in to comment.