Browse Source

[Fix-12356][k8s] fix the null exception when submitting k8s task plugin (#12358)

3.1.1-release
rickchengx 2 years ago committed by zhuangchong
parent
commit
1e62855fa9
  1. 15
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java

15
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java

@ -42,6 +42,7 @@ import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.Cluster;
import org.apache.dolphinscheduler.dao.entity.Command;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.DataSource;
@ -54,7 +55,6 @@ import org.apache.dolphinscheduler.dao.entity.DqRuleInputEntry;
import org.apache.dolphinscheduler.dao.entity.DqTaskStatisticsValue;
import org.apache.dolphinscheduler.dao.entity.Environment;
import org.apache.dolphinscheduler.dao.entity.ErrorCommand;
import org.apache.dolphinscheduler.dao.entity.K8s;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
@ -73,6 +73,7 @@ import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ClusterMapper;
import org.apache.dolphinscheduler.dao.mapper.CommandMapper;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.DqComparisonTypeMapper;
@ -83,7 +84,6 @@ import org.apache.dolphinscheduler.dao.mapper.DqRuleMapper;
import org.apache.dolphinscheduler.dao.mapper.DqTaskStatisticsValueMapper;
import org.apache.dolphinscheduler.dao.mapper.EnvironmentMapper;
import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper;
import org.apache.dolphinscheduler.dao.mapper.K8sMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapMapper;
@ -272,7 +272,7 @@ public class ProcessServiceImpl implements ProcessService {
private TaskPluginManager taskPluginManager;
@Autowired
private K8sMapper k8sMapper;
private ClusterMapper clusterMapper;
@Autowired
private CuringParamsService curingGlobalParamsService;
@ -3139,10 +3139,11 @@ public class ProcessServiceImpl implements ProcessService {
if (Strings.isNullOrEmpty(clusterName)) {
return null;
}
QueryWrapper<K8s> nodeWrapper = new QueryWrapper<>();
nodeWrapper.eq("k8s_name", clusterName);
K8s k8s = k8sMapper.selectOne(nodeWrapper);
return k8s.getK8sConfig();
QueryWrapper<Cluster> nodeWrapper = new QueryWrapper<>();
nodeWrapper.eq("name", clusterName);
Cluster cluster = clusterMapper.selectOne(nodeWrapper);
return cluster == null ? null : cluster.getConfig();
}
@Override

Loading…
Cancel
Save