Browse Source

When running a task, the resource file is lost, which results in an error

pull/3/MERGE
BoYiZhang 4 years ago
parent
commit
7dd717af16
  1. 14
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/VarPoolUtils.java

14
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/VarPoolUtils.java

@ -26,6 +26,12 @@ import java.util.Map;
public class VarPoolUtils { public class VarPoolUtils {
private static final String LOCALPARAMS = "localParams";
private static final String PROP = "prop";
private static final String VALUE = "value";
/** /**
* setTaskNodeLocalParams * setTaskNodeLocalParams
* @param taskNode taskNode * @param taskNode taskNode
@ -35,17 +41,17 @@ public class VarPoolUtils {
String taskParamsJson = taskNode.getParams(); String taskParamsJson = taskNode.getParams();
Map<String,Object> taskParams = JSONUtils.parseObject(taskParamsJson, HashMap.class); Map<String,Object> taskParams = JSONUtils.parseObject(taskParamsJson, HashMap.class);
Object localParamsObject = taskParams.get("localParams"); Object localParamsObject = taskParams.get(LOCALPARAMS);
if (null != localParamsObject && null != propToValue && propToValue.size() > 0) { if (null != localParamsObject && null != propToValue && propToValue.size() > 0) {
ArrayList<Object> localParams = (ArrayList)localParamsObject; ArrayList<Object> localParams = (ArrayList)localParamsObject;
for (int i = 0; i < localParams.size(); i++) { for (int i = 0; i < localParams.size(); i++) {
Map<String,String> map = (Map)localParams.get(i); Map<String,String> map = (Map)localParams.get(i);
String prop = map.get("prop"); String prop = map.get(PROP);
if (StringUtils.isNotEmpty(prop) && propToValue.containsKey(prop)) { if (StringUtils.isNotEmpty(prop) && propToValue.containsKey(prop)) {
map.put("value",(String)propToValue.get(prop)); map.put(VALUE,(String)propToValue.get(prop));
} }
} }
taskParams.put("localParams",localParams); taskParams.put(LOCALPARAMS,localParams);
} }
taskNode.setParams(JSONUtils.toJsonString(taskParams)); taskNode.setParams(JSONUtils.toJsonString(taskParams));
} }

Loading…
Cancel
Save