feat:新增jupyter查询状态接口
This commit is contained in:
parent
55eeb0a126
commit
350bff0c46
|
@ -68,6 +68,7 @@ public class DevEnvironmentServiceImpl implements DevEnvironmentService {
|
|||
devEnvironment.setUpdateBy(loginUser.getUsername());
|
||||
devEnvironment.setUpdateTime(new Date());
|
||||
devEnvironment.setCreateTime(new Date());
|
||||
devEnvironment.setState(1);
|
||||
this.devEnvironmentDao.insert(devEnvironment);
|
||||
return devEnvironment;
|
||||
}
|
||||
|
|
|
@ -89,10 +89,12 @@ public class JupyterServiceImpl implements JupyterService {
|
|||
String modelPath = (String) model.get("path");
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String podName = loginUser.getUsername().toLowerCase() + "-editor-pod";
|
||||
//手动构造pod名称
|
||||
String podName = loginUser.getUsername().toLowerCase() + "-" + "-editor-pod" + id;
|
||||
String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc";
|
||||
V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName);
|
||||
|
||||
|
||||
//TODO 设置镜像可配置,这里先用默认镜像启动pod
|
||||
|
||||
// 调用修改后的 createPod 方法,传入额外的参数
|
||||
|
@ -110,7 +112,8 @@ public class JupyterServiceImpl implements JupyterService {
|
|||
}
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String podName = loginUser.getUsername().toLowerCase() + "-editor-pod";
|
||||
//手动构造pod名称
|
||||
String podName = loginUser.getUsername().toLowerCase() + "-" + devEnvironment.getName() +"-editor-pod" + id;
|
||||
//得到pod
|
||||
V1Pod pod = k8sClientUtil.getNSPodList(namespace, podName);
|
||||
if(pod == null){
|
||||
|
@ -119,6 +122,7 @@ public class JupyterServiceImpl implements JupyterService {
|
|||
// 使用 Kubernetes API 删除 Pod
|
||||
String deleteResult = k8sClientUtil.deletePod(podName, namespace);
|
||||
|
||||
|
||||
return deleteResult + ",编辑器已停止";
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,9 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||
public String removeById(Long id) throws Exception {
|
||||
//先根据id提取出对应的流水线
|
||||
Workflow workflow = workflowDao.queryById(id);
|
||||
|
||||
if (workflow == null){
|
||||
throw new Exception("流水线不存在");
|
||||
}
|
||||
//判断权限,只有admin和创建者本身可以删除该流水线
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String username = loginUser.getUsername();
|
||||
|
@ -142,9 +144,6 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||
throw new Exception("无权限删除该流水线");
|
||||
}
|
||||
|
||||
if (workflow == null){
|
||||
throw new Exception("流水线不存在");
|
||||
}
|
||||
//判断这个流水线是否有相关实验存在
|
||||
List<Experiment> experimentList = experimentService.queryByWorkflowId(id);
|
||||
if (experimentList!=null&&experimentList.size()>0){
|
||||
|
|
Loading…
Reference in New Issue