Browse Source

fix issue

pull/3433/head
zhoupzh 2 years ago
parent
commit
ec1cb958d1
2 changed files with 74 additions and 31 deletions
  1. +11
    -2
      web_src/vuepages/apis/modules/notobook.js
  2. +63
    -29
      web_src/vuepages/pages/notebook/debug/index.vue

+ 11
- 2
web_src/vuepages/apis/modules/notobook.js View File

@@ -29,7 +29,7 @@ export const getCb1Notebook = (path,jobid) => {
});
};

// Notebook获取云脑I调试任务状态
// Notebook获取云脑II调试任务状态
export const getCb2Notebook = (path,jobid) => {
return service({
url: `/api/v1/${path}/modelarts/notebook/${jobid}`,
@@ -37,7 +37,16 @@ export const getCb2Notebook = (path,jobid) => {
params: {},
});
};

// Notebook查询文件在环境中是否已准备好
// type, file, branch_name, owner_name, project_name,job_id
export const getFileInfoNotebook = (data) => {
return service({
url: "/api/v1/file_notebook/status",
method: "post",
data,
params: {},
});
};
export const stopNotebook = (url) => {
return service({
url: url,


+ 63
- 29
web_src/vuepages/pages/notebook/debug/index.vue View File

@@ -178,9 +178,9 @@
</div>
</template>
<script>
import { getFileNotebook,createNotebook,getCb1Notebook,getCb2Notebook,stopNotebook } from "~/apis/modules/notobook";
import { getFileNotebook,createNotebook,getCb1Notebook,getCb2Notebook,getFileInfoNotebook,stopNotebook } from "~/apis/modules/notobook";
import { Message } from "element-ui";
let timerCb1,timerCb2
let timerCb1,timerCb2,timerCb3
let {AppSubUrl} = window.config
const finalState = [
"STOPPED",
@@ -253,27 +253,28 @@ export default {
if(this.activeLoadFirst){
this.loading = true
}
getFileNotebook().then((res)=>{
if(res.data.code==0){
this.notebookInfo = res.data
}else{
Message.error(res.data.message)
}
this.loading = false
this.activeLoadFirst = false
}).catch((err)=>{
Message.error(err)
this.loading = false
this.activeLoadFirst = false
})
getFileNotebook().then((res)=>{
if(res.data.code==0){
this.notebookInfo = res.data
}else{
Message.error(res.data.message)
}
this.loading = false
this.activeLoadFirst = false
}).catch((err)=>{
Message.error(err)
this.loading = false
this.activeLoadFirst = false
})
},
getCb1NotebookInfo(path,id,index){
getCb1NotebookInfo(path,id,index,data){
getCb1Notebook(path,id).then((res)=>{
if(res.status===200){
if(res.data.JobStatus==="RUNNING"){
this.btnStatus[index]=2
this.deubgUrlGpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/cloudbrain/${id}/debug`
this.deubgUrlGpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/cloudbrain/${id}/stop`
let fileData = {job_id:id,...data}
timerCb3 = setInterval(() => {
setTimeout(this.getFileInfoReadyNotebook(fileData,index), 0)
}, 10000)
clearInterval(timerCb1)
}
if(finalState.includes(res.data.JobStatus)){
@@ -281,23 +282,56 @@ export default {
clearInterval(timerCb1)
}
}
})
}).catch((err)=>{
this.btnStatus[index]=0
clearInterval(timerCb1)
Message.error(err)
})
},
getCb2NotebookInfo(path,id){
getCb2NotebookInfo(path,id,data){
getCb2Notebook(path,id).then((res)=>{
if(res.status===200){
if(res.data.JobStatus==="RUNNING"){
this.btnStatus[2]=2
this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/debug`
this.deubgUrlNpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/stop`
clearInterval(timerCb2)
if(res.data.JobStatus==="RUNNING"){
let fileData = {job_id:id,...data}
timerCb3 = setInterval(() => {
setTimeout(this.getFileInfoReadyNotebook(fileData,2), 0)
}, 10000)
// this.btnStatus[2]=2
// this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/debug`
// this.deubgUrlNpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/stop`
clearInterval(timerCb2)
}
if(finalState.includes(res.data.JobStatus)){
this.btnStatus[2] = 0
clearInterval(timerCb2)
}
}
})
}).catch((err)=>{
this.btnStatus[index]=0
clearInterval(timerCb2)
Message.error(err)
})
},
getFileInfoReadyNotebook(data,index){
getFileInfoNotebook(data).then((res)=>{
console.log(res)
if(res.data.code===0){
if(index===2){
this.btnStatus[2]=2
this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${data.job_id}/debug?file=${this.fileInfo.owner_name}/${this.fileInfo.project_name}/${this.fileInfo.file}`
this.deubgUrlNpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${data.job_id}/stop`
}else{
this.btnStatus[index]=2
this.deubgUrlGpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/cloudbrain/${data.job_id}/debug?file=${this.fileInfo.owner_name}/${this.fileInfo.project_name}/${this.fileInfo.file}`
this.deubgUrlGpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/cloudbrain/${data.job_id}/stop`
}
clearInterval(timerCb3)
}
}).catch((err)=>{
this.btnStatus[index]=0
clearInterval(timerCb3)
Message.error(err)
})
},
stopDebug(index){
this.btnStatus[index]=3
@@ -323,11 +357,11 @@ export default {
if(res.data.code===0 && res.status===200){
if(index===2){
timerCb2 = setInterval(() => {
setTimeout(this.getCb2NotebookInfo(repoPath,res.data.message), 0)
setTimeout(this.getCb2NotebookInfo(repoPath,res.data.message,data), 0)
}, 10000)
}else{
timerCb1 = setInterval(() => {
setTimeout(this.getCb1NotebookInfo(repoPath,res.data.message,index), 0)
setTimeout(this.getCb1NotebookInfo(repoPath,res.data.message,index,data), 0)
}, 10000)
}
this.alertCb = false


Loading…
Cancel
Save