Browse Source

fix issue

tags/v1.22.11.3^2
zhoupzh 3 years ago
parent
commit
56dc359315
3 changed files with 38 additions and 10 deletions
  1. +1
    -0
      routers/api/v1/repo/cloudbrain.go
  2. +11
    -2
      web_src/vuepages/apis/modules/notobook.js
  3. +26
    -8
      web_src/vuepages/pages/notebook/debug/index.vue

+ 1
- 0
routers/api/v1/repo/cloudbrain.go View File

@@ -134,6 +134,7 @@ func GetFileNoteBookInfo(ctx *context.APIContext) {
} else{
ctx.JSON(http.StatusOK, map[string]interface{}{
"code": 0,
"projectName":setting.FileNoteBook.ProjectName,
"specCpu": specCPU,
"specGpu": specGpu,
"specNpu": specNPUCD,


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

@@ -20,7 +20,7 @@ export const createNotebook = (data) => {
});
};

// Notebook新建页面需要的信息
// Notebook获取云脑I调试任务状态
export const getCb1Notebook = (path,jobid) => {
return service({
url: `/api/v1/${path}/cloudbrain/${jobid}`,
@@ -29,7 +29,7 @@ export const getCb1Notebook = (path,jobid) => {
});
};

// Notebook新建页面需要的信息
// Notebook获取云脑I调试任务状态
export const getCb2Notebook = (path,jobid) => {
return service({
url: `/api/v1/${path}/modelarts/notebook/${jobid}`,
@@ -37,3 +37,12 @@ export const getCb2Notebook = (path,jobid) => {
params: {},
});
};

export const stopNotebook = (url) => {
return service({
url: url,
method: "post",
data,
params: {},
});
};

+ 26
- 8
web_src/vuepages/pages/notebook/debug/index.vue View File

@@ -116,10 +116,10 @@
<button v-if="btnStatus[2]===0" class="ui green small button" @click="createTask(2)"></i>新建任务3</button>
<button v-else-if="btnStatus[2]===1"class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>新建任务</button>
<div v-else>
<button class="ui small button" style="background-color: #1684fc;">
<button class="ui small button" style="background-color: #1684fc;color:#fff">
<a :href="deubgUrlNpu" target="_blank">调试</a>
</button>
<button class="ui small button">停止</button>
<button class="ui small button" @click="stopDebug(2)">停止</button>
</div>
<span>当前有个<span style="color: red;">{{waitCount}}</span>任务在排队</span>
</div>
@@ -129,7 +129,7 @@
</div>
</template>
<script>
import { getFileNotebook,createNotebook,getCb1Notebook,getCb2Notebook } from "~/apis/modules/notobook";
import { getFileNotebook,createNotebook,getCb1Notebook,getCb2Notebook,stopNotebook } from "~/apis/modules/notobook";
import { Message } from "element-ui";
let timerCb1,timerCb2
let {AppSubUrl} = window.config
@@ -155,6 +155,8 @@ export default {
alertCb:false,
deubgUrlNpu:'',
deubgUrlGpu:'',
deubgUrlNpuStop:'',
deubgUrlGpuStop:'',
};
},
methods: {
@@ -198,7 +200,9 @@ export default {
if(res.status===200){
if(res.data.JobStatus==="RUNNING"){
this.btnStatus[2]=2
this.deubgUrlGpu = `${AppSubUrl}/${this.fileInfo.owner_name}/${this.notebookInfo.projectName}/cloudbrain/${id}/debug`
this.deubgUrlGpuStop = `${AppSubUrl}/${this.fileInfo.owner_name}/${this.notebookInfo.projectName}/cloudbrain/${id}/stop`
clearInterval(timerCb1)
}
}
})
@@ -209,11 +213,24 @@ export default {
if(res.status===200){
if(res.data.JobStatus==="RUNNING"){
this.btnStatus[2]=2
this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.owner_name}/${this.fileInfo.project_name}/modelarts/notebook/${id}/`
this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.owner_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/debug`
this.deubgUrlNpuStop = `${AppSubUrl}/${this.fileInfo.owner_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/stop`
clearInterval(timerCb2)
}
}
})
},
stopDebug(index){
if(index===2){
stopNotebook(this.deubgUrlNpuStop).then((res)=>{
console.log(res)
})
}else{
stopNotebook(this.deubgUrlGpuStop).then((res)=>{
console.log(res)
})
}
},
createTask(index){
this.btnStatus[index]=1
const data = {type:index,...this.fileInfo}
@@ -226,12 +243,13 @@ export default {
console.log("index",index)
timerCb2 = setInterval(() => {
setTimeout(this.getCb2NotebookInfo(repoPath,res.data.message), 0)
}, 3000)
}, 10000)
}else{
timerCb1 = setInterval(() => {
setTimeout(this.getCb1NotebookInfo(repoPath,res.data.message), 0)
}, 3000)
}, 10000)
}
this.alertCb = false
}else if(res.data.code===1 && res.status===403){
this.btnStatus[index]=0
@@ -243,7 +261,7 @@ export default {
}
}).catch((err)=>{
this.btnStatus[index]=0
console.log(err)
this.alertCb = false
Message.error(err)
})


Loading…
Cancel
Save