Browse Source

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

3.2.0-release
rickchengx 2 years ago committed by GitHub
parent
commit
97edc7d652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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

@ -50,6 +50,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;
@ -62,7 +63,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;
@ -81,6 +81,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;
@ -91,7 +92,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;
@ -276,7 +276,7 @@ public class ProcessServiceImpl implements ProcessService {
private TaskPluginManager taskPluginManager;
@Autowired
private K8sMapper k8sMapper;
private ClusterMapper clusterMapper;
@Autowired
private CuringParamsService curingGlobalParamsService;
@ -3170,10 +3170,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