diff --git a/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/context/SparkConfig.java b/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/context/SparkConfig.java index 24d3ddcb2c..3d0fc0ff3b 100644 --- a/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/context/SparkConfig.java +++ b/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/context/SparkConfig.java @@ -17,6 +17,8 @@ package org.apache.linkis.engineplugin.spark.client.context; +import org.apache.commons.lang3.StringUtils; + import java.util.HashMap; import java.util.Map; @@ -131,6 +133,10 @@ public String getK8sConfigFile() { } public void setK8sConfigFile(String k8sConfigFile) { + if (StringUtils.isNotBlank(k8sConfigFile) && k8sConfigFile.startsWith("~")) { + String user = System.getProperty("user.home"); + k8sConfigFile = k8sConfigFile.replaceFirst("~", user); + } this.k8sConfigFile = k8sConfigFile; } diff --git a/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/deployment/KubernetesOperatorClusterDescriptorAdapter.java b/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/deployment/KubernetesOperatorClusterDescriptorAdapter.java index 3ea27b394f..eafa8abec5 100644 --- a/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/deployment/KubernetesOperatorClusterDescriptorAdapter.java +++ b/linkis-engineconn-plugins/spark/src/main/java/org/apache/linkis/engineplugin/spark/client/deployment/KubernetesOperatorClusterDescriptorAdapter.java @@ -180,10 +180,12 @@ private void getKubernetesOperatorState() { @Override public void eventReceived(Action action, SparkApplication sparkApplication) { // todo get status - applicationId = sparkApplication.getStatus().getSparkApplicationId(); - jobState = - kubernetesOperatorStateConvertSparkState( - sparkApplication.getStatus().getApplicationState().getState()); + if (Objects.nonNull(sparkApplication.getStatus())) { + applicationId = sparkApplication.getStatus().getSparkApplicationId(); + jobState = + kubernetesOperatorStateConvertSparkState( + sparkApplication.getStatus().getApplicationState().getState()); + } } @Override