| @@ -101,6 +101,12 @@ public class JupyterServiceImpl implements JupyterService { | |||||
| // 调用修改后的 createPod 方法,传入额外的参数 | // 调用修改后的 createPod 方法,传入额外的参数 | ||||
| Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, image, minioPvcName, datasetPath, modelPath); | Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, image, minioPvcName, datasetPath, modelPath); | ||||
| // 简单的延迟,以便 Pod 有时间启动 | |||||
| Thread.sleep(2500); | |||||
| //查询pod状态,更新到数据库 | |||||
| String podStatus = k8sClientUtil.getPodStatus(podName, namespace); | |||||
| devEnvironment.setStatus(podStatus); | |||||
| this.devEnvironmentService.update(devEnvironment); | |||||
| return masterIp + ":" + podPort; | return masterIp + ":" + podPort; | ||||
| @@ -112,7 +118,6 @@ public class JupyterServiceImpl implements JupyterService { | |||||
| if (devEnvironment==null){ | if (devEnvironment==null){ | ||||
| throw new Exception("开发环境配置不存在"); | throw new Exception("开发环境配置不存在"); | ||||
| } | } | ||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| //手动构造pod名称 | //手动构造pod名称 | ||||
| String podName = loginUser.getUsername().toLowerCase() +"-editor-pod" + "-" + id; | String podName = loginUser.getUsername().toLowerCase() +"-editor-pod" + "-" + id; | ||||
| @@ -124,6 +129,8 @@ public class JupyterServiceImpl implements JupyterService { | |||||
| // 使用 Kubernetes API 删除 Pod | // 使用 Kubernetes API 删除 Pod | ||||
| String deleteResult = k8sClientUtil.deletePod(podName, namespace); | String deleteResult = k8sClientUtil.deletePod(podName, namespace); | ||||
| devEnvironment.setStatus("Terminating"); | |||||
| this.devEnvironmentService.update(devEnvironment); | |||||
| return deleteResult + ",编辑器已停止"; | return deleteResult + ",编辑器已停止"; | ||||
| } | } | ||||