|
|
|
@@ -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) |
|
|
|
|
|
|
|
}) |
|
|
|
|