Browse Source

feat:新增jupyter查询状态接口

pull/83/head
西大锐 1 year ago
parent
commit
2ddfb77be5
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java

+ 4
- 3
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java View File

@@ -90,7 +90,7 @@ public class JupyterServiceImpl implements JupyterService {


LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
//手动构造pod名称 //手动构造pod名称
String podName = loginUser.getUsername().toLowerCase() + "-" + "-editor-pod" + id;
String podName = loginUser.getUsername().toLowerCase() + "-" + devEnvironment.getName() +"-editor-pod" + "-" + id;
String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc"; String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc";
V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName); V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName);


@@ -113,7 +113,7 @@ public class JupyterServiceImpl implements JupyterService {


LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
//手动构造pod名称 //手动构造pod名称
String podName = loginUser.getUsername().toLowerCase() + "-" + devEnvironment.getName() +"-editor-pod" + id;
String podName = loginUser.getUsername().toLowerCase() + "-" + devEnvironment.getName() +"-editor-pod" + "-" + id;
//得到pod //得到pod
V1Pod pod = k8sClientUtil.getNSPodList(namespace, podName); V1Pod pod = k8sClientUtil.getNSPodList(namespace, podName);
if(pod == null){ if(pod == null){
@@ -122,7 +122,6 @@ public class JupyterServiceImpl implements JupyterService {
// 使用 Kubernetes API 删除 Pod // 使用 Kubernetes API 删除 Pod
String deleteResult = k8sClientUtil.deletePod(podName, namespace); String deleteResult = k8sClientUtil.deletePod(podName, namespace);



return deleteResult + ",编辑器已停止"; return deleteResult + ",编辑器已停止";
} }


@@ -149,6 +148,8 @@ public class JupyterServiceImpl implements JupyterService {


} catch (Exception e) { } catch (Exception e) {
return JupyterStatusVo; return JupyterStatusVo;


} }
String url = redisService.getCacheObject(podName); String url = redisService.getCacheObject(podName);
JupyterStatusVo.setStatus(status); JupyterStatusVo.setStatus(status);


Loading…
Cancel
Save