|
|
@@ -5,12 +5,13 @@ |
|
|
|
:visible.sync="dialogVisible" |
|
|
|
width="50%" |
|
|
|
:close-on-click-modal="false" |
|
|
|
@closed="handleClose" |
|
|
|
> |
|
|
|
<div class="wrapper"> |
|
|
|
<div |
|
|
|
class="three-resource-type" |
|
|
|
:class="{ active: selectIndex == 0 }" |
|
|
|
@click="selectResource(0)" |
|
|
|
@click="selectResource(0,'waitCountGpu')" |
|
|
|
> |
|
|
|
<div class="resource-child-node"> |
|
|
|
<div class="resource-type-icon background-C"> |
|
|
@@ -19,14 +20,14 @@ |
|
|
|
<div class="resource-type-detail"> |
|
|
|
<div class="detail-title"><span>CPU 环境</span></div> |
|
|
|
<div class="detail-spec"> |
|
|
|
<span>规格:CPU: 4,内存: 32GB,共享内存: 16GB</span> |
|
|
|
<span>{{cpuSpec}}</span> |
|
|
|
</div> |
|
|
|
<div class="detail-spec"> |
|
|
|
<span>镜像: ubuntuxx. xx-py37-torch1.9.1</span> |
|
|
|
<span>镜像:{{notebookInfo.imageCpuDescription}}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="resource-select"> |
|
|
|
<i v-if="selectIndex===0" :class="[slideActive ?'slide-in-top':'slide-in-bottom']" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i v-if="selectIndex===0" :class="{'slide-in-bottom': !slideActive && !initSelect }" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i |
|
|
|
class="ri-checkbox-blank-circle-line gray" |
|
|
|
:class="{'fade-out':selectIndex===0}" |
|
|
@@ -37,23 +38,24 @@ |
|
|
|
<div |
|
|
|
class="three-resource-type" |
|
|
|
:class="{ active: selectIndex == 1 }" |
|
|
|
@click="selectResource(1)" |
|
|
|
@click="selectResource(1,'waitCountGpu')" |
|
|
|
> |
|
|
|
<div class="resource-child-node"> |
|
|
|
<div class="resource-type-icon background-N"> |
|
|
|
<span class="text">N</span> |
|
|
|
<div class="resource-type-icon background-G"> |
|
|
|
<span class="text">G</span> |
|
|
|
</div> |
|
|
|
<div class="resource-type-detail"> |
|
|
|
<div class="detail-title"><span>CPU 环境</span></div> |
|
|
|
<div class="detail-title"><span>GPU 环境</span></div> |
|
|
|
<div class="detail-spec"> |
|
|
|
<span>规格:CPU: 4,内存: 32GB,共享内存: 16GB</span> |
|
|
|
<span>{{gpuSpec}}</span> |
|
|
|
</div> |
|
|
|
<div class="detail-spec"> |
|
|
|
<span>镜像: ubuntuxx. xx-py37-torch1.9.1</span> |
|
|
|
<span>镜像:{{notebookInfo.imageGpuDescription}}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="resource-select"> |
|
|
|
<i v-if="selectIndex===1" :class="[slideActive ?'slide-in-top':'slide-in-bottom']" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i v-if="selectIndex===1 && !initSelect" :class="[slideActive && !initSelect ?'slide-in-top':'slide-in-bottom']" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i v-if="selectIndex===1 && initSelect" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i |
|
|
|
class="ri-checkbox-blank-circle-line gray" |
|
|
|
:class="{'fade-out':selectIndex===1}" |
|
|
@@ -64,23 +66,23 @@ |
|
|
|
<div |
|
|
|
class="three-resource-type" |
|
|
|
:class="{ active: selectIndex == 2 }" |
|
|
|
@click="selectResource(2)" |
|
|
|
@click="selectResource(2,'waitCountNpu')" |
|
|
|
> |
|
|
|
<div class="resource-child-node"> |
|
|
|
<div class="resource-type-icon background-G"> |
|
|
|
<span class="text">G</span> |
|
|
|
<div class="resource-type-icon background-N"> |
|
|
|
<span class="text">N</span> |
|
|
|
</div> |
|
|
|
<div class="resource-type-detail"> |
|
|
|
<div class="detail-title"><span>CPU 环境</span></div> |
|
|
|
<div class="detail-title"><span>NPU 环境</span></div> |
|
|
|
<div class="detail-spec"> |
|
|
|
<span>规格:CPU: 4,内存: 32GB,共享内存: 16GB</span> |
|
|
|
<span>{{npuSpec}}</span> |
|
|
|
</div> |
|
|
|
<div class="detail-spec"> |
|
|
|
<span>镜像: ubuntuxx. xx-py37-torch1.9.1</span> |
|
|
|
<span>镜像:{{notebookInfo.imageCpuDescription}}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="resource-select"> |
|
|
|
<i v-if="selectIndex===2" :class="[slideActive ?'slide-in-top':'slide-in-bottom']" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i v-if="selectIndex===2" :class="{'slide-in-top': slideActive && !initSelect}" class="ri-checkbox-circle-line green"></i> |
|
|
|
<i |
|
|
|
class="ri-checkbox-blank-circle-line gray" |
|
|
|
:class="{'fade-out':selectIndex===2}" |
|
|
@@ -89,8 +91,26 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="resource-footer"> |
|
|
|
<div class="resource-operate"> |
|
|
|
<button class="ui green button">新建任务</button> |
|
|
|
<div class="resource-operate" v-if="selectIndex==0"> |
|
|
|
<button v-if="btnStatus[0]===0" class="ui green small button" @click="createTask(0)"></i>新建任务1</button> |
|
|
|
<button v-else-if="btnStatus[0]===1"class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>新建任务</button> |
|
|
|
<button v-else>aaaa</button> |
|
|
|
<span>当前有个<span style="color: red;">{{waitCount}}</span>任务在排队</span> |
|
|
|
</div> |
|
|
|
<div class="resource-operate" v-if="selectIndex==1"> |
|
|
|
<button v-if="btnStatus[1]===0" class="ui green small button" @click="createTask(1)"></i>新建任务2</button> |
|
|
|
<button v-else-if="btnStatus[1]===1"class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>新建任务</button> |
|
|
|
<button v-else>aaaa</button> |
|
|
|
<span>当前有个<span style="color: red;">{{waitCount}}</span>任务在排队</span> |
|
|
|
</div> |
|
|
|
<div class="resource-operate" v-if="selectIndex==2"> |
|
|
|
<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> |
|
|
|
<button class="ui small button">停止</button> |
|
|
|
</div> |
|
|
|
<span>当前有个<span style="color: red;">{{waitCount}}</span>任务在排队</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@@ -98,24 +118,35 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { getFileNotebook } from "~/apis/modules/notobook"; |
|
|
|
import { getFileNotebook,createNotebook,getCb1Notebook,getCb2Notebook } from "~/apis/modules/notobook"; |
|
|
|
let timerCb1,timerCb2 |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
dialogVisible: false, |
|
|
|
selectIndex: 0, |
|
|
|
slideActive:true, |
|
|
|
initSelect:true, |
|
|
|
notebookInfo:{specCpu:{acc_cards_num:0},specGpu:{acc_cards_num:0},specNpu:{acc_cards_num:0}}, |
|
|
|
waitCount:0, |
|
|
|
fileInfo:{ |
|
|
|
file:'', |
|
|
|
branch_name:'', |
|
|
|
owner_name:'', |
|
|
|
project_name:'', |
|
|
|
}, |
|
|
|
btnStatus:{0:0,1:0,2:0}, |
|
|
|
firtstStatus:0, |
|
|
|
secondStatus:0, |
|
|
|
thirdStatus:0, |
|
|
|
}; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
handleClose(done) { |
|
|
|
this.$confirm("确认关闭?") |
|
|
|
.then((_) => { |
|
|
|
done(); |
|
|
|
}) |
|
|
|
.catch((_) => {}); |
|
|
|
console.log("close") |
|
|
|
this.initSelect = true |
|
|
|
}, |
|
|
|
selectResource(index) { |
|
|
|
selectResource(index,type) { |
|
|
|
if(index==this.selectIndex){ |
|
|
|
return |
|
|
|
} |
|
|
@@ -125,17 +156,92 @@ export default { |
|
|
|
this.slideActive = false |
|
|
|
} |
|
|
|
this.selectIndex = index; |
|
|
|
this.initSelect = false |
|
|
|
this.waitCount += this.notebookInfo[type] +1 |
|
|
|
}, |
|
|
|
getNotebookInfo(){ |
|
|
|
getFileNotebook().then((res)=>{ |
|
|
|
console.log(res) |
|
|
|
if(res.data.code==0){ |
|
|
|
this.notebookInfo = res.data |
|
|
|
this.waitCount = res.data.waitCountGpu |
|
|
|
}else{ |
|
|
|
console.log(res.data.message) |
|
|
|
} |
|
|
|
}).catch((err)=>{ |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getCb1NotebookInfo(id){ |
|
|
|
getCb1Notebook(id).then((res)=>{ |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getCb2NotebookInfo(id){ |
|
|
|
getCb2Notebook(id).then((res)=>{ |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
}, |
|
|
|
createTask(index){ |
|
|
|
this.btnStatus[index]=1 |
|
|
|
const data = {type:index,...this.fileInfo} |
|
|
|
createNotebook(data).then((res)=>{ |
|
|
|
console.log("=========",res) |
|
|
|
if(res.data.code===0 && res.status===200){ |
|
|
|
// this.btnStatus[index]=2 |
|
|
|
if(index===2){ |
|
|
|
timerCb2 = setInterval(() => { |
|
|
|
setTimeout(this.getCb2NotebookInfo(res.data.message), 0) |
|
|
|
}, 3000) |
|
|
|
}else{ |
|
|
|
timerCb1 = setInterval(() => { |
|
|
|
setTimeout(this.getCb1NotebookInfo(res.data.message), 0) |
|
|
|
}, 3000) |
|
|
|
} |
|
|
|
|
|
|
|
}else if(res.data.code===1 && res.status===403){ |
|
|
|
this.btnStatus[index]=0 |
|
|
|
}else{ |
|
|
|
this.btnStatus[index]=0 |
|
|
|
} |
|
|
|
}).catch((err)=>{ |
|
|
|
this.btnStatus[index]=0 |
|
|
|
console.log(err) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
cpuSpec(){ |
|
|
|
return `规格:GPU: ${this.notebookInfo.specCpu.acc_cards_num}*${this.notebookInfo.specCpu.acc_card_type}, |
|
|
|
CPU: ${this.notebookInfo.specCpu.cpu_cores}, 显存: ${this.notebookInfo.specCpu.gpu_mem_gi_b}GB, |
|
|
|
内存: ${this.notebookInfo.specCpu.mem_gi_b}GB, 共享内存: ${this.notebookInfo.specCpu.share_mem_gi_b}GB` |
|
|
|
}, |
|
|
|
npuSpec(){ |
|
|
|
return `规格:NPU: ${this.notebookInfo.specNpu.acc_cards_num}*${this.notebookInfo.specNpu.acc_card_type}, |
|
|
|
CPU: ${this.notebookInfo.specNpu.cpu_cores}, 显存: ${this.notebookInfo.specNpu.gpu_mem_gi_b}GB, |
|
|
|
内存: ${this.notebookInfo.specNpu.mem_gi_b}GB, 共享内存: ${this.notebookInfo.specNpu.share_mem_gi_b}GB` |
|
|
|
}, |
|
|
|
gpuSpec(){ |
|
|
|
return `规格:NPU: ${this.notebookInfo.specGpu.acc_cards_num}*${this.notebookInfo.specGpu.acc_card_type}, |
|
|
|
CPU: ${this.notebookInfo.specGpu.cpu_cores}, 显存: ${this.notebookInfo.specGpu.gpu_mem_gi_b}GB, |
|
|
|
内存: ${this.notebookInfo.specGpu.mem_gi_b}GB, 共享内存: ${this.notebookInfo.specGpu.share_mem_gi_b}GB` |
|
|
|
} |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
clearInterval(timerCb1) |
|
|
|
clearInterval(timerCb2) |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.getNotebookInfo() |
|
|
|
// this.dialogVisible = true |
|
|
|
console.log("-------------"); |
|
|
|
console.log("-----------aaaaa--"); |
|
|
|
const selfData = document.querySelector('#__vue-self-data') |
|
|
|
this.fileInfo.file = selfData.getAttribute('data-file') |
|
|
|
this.fileInfo.branch_name = selfData.getAttribute('data-branch') |
|
|
|
this.fileInfo.owner_name = selfData.getAttribute('data-owner') |
|
|
|
this.fileInfo.project_name = selfData.getAttribute('data-project') |
|
|
|
console.log(this.fileInfo) |
|
|
|
let that = this; |
|
|
|
document |
|
|
|
.querySelector("#notebook-debug") |
|
|
@@ -284,6 +390,7 @@ export default { |
|
|
|
align-items: center; |
|
|
|
.resource-operate { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
} |
|
|
|
} |
|
|
|
.slide-in-top { |
|
|
|