| @@ -238,6 +238,7 @@ | |||
| {{$.i18n.Tr "repo.debug"}} | |||
| </a> | |||
| {{else}} | |||
| {{if not .BootFile}} | |||
| <a id="ai-debug-{{$JobID}}" | |||
| class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' | |||
| data-jobid="{{$JobID}}" | |||
| @@ -245,6 +246,7 @@ | |||
| {{$.i18n.Tr "repo.debug_again"}} | |||
| </a> | |||
| {{end}} | |||
| {{end}} | |||
| </form> | |||
| </div> | |||
| {{end}} | |||
| @@ -266,6 +266,7 @@ | |||
| {{$.i18n.Tr "repo.debug"}} | |||
| </a> | |||
| {{else}} | |||
| {{if not .BootFile}} | |||
| <a id="ai-debug-{{.Cloudbrain.ID}}" | |||
| class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' | |||
| data-jobid="{{.Cloudbrain.ID}}" | |||
| @@ -274,6 +275,7 @@ | |||
| {{$.i18n.Tr "repo.debug_again"}} | |||
| </a> | |||
| {{end}} | |||
| {{end}} | |||
| {{else}} | |||
| {{if eq .Status "RUNNING" "WAITING" "CREATING" "STARTING"}} | |||
| <a class="ui basic disabled button"> | |||
| @@ -124,7 +124,8 @@ | |||
| style="width: 8% !important;"> | |||
| <span class="job-status" id="{{$JobID}}" | |||
| data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "DEBUG"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts{{end}}/inference-job{{else if eq .JobType "TRAIN"}}{{if eq .ComputeResource "NPU"}}/modelarts/train-job{{else}}/cloudbrain/train-job{{end}}{{else if eq .JobType "BENCHMARK" "MODELSAFETY"}}/cloudbrain{{end}}' | |||
| data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
| data-jobid="{{$JobID}}" data-version="{{.VersionName}}" | |||
| data-bootfile="{{.BootFile}}"> | |||
| <span><i id="{{$JobID}}-icon" style="vertical-align: middle;" | |||
| class="{{.Status}}"></i><span id="{{$JobID}}-text" | |||
| style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||
| @@ -185,7 +186,6 @@ | |||
| <a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}" | |||
| title="{{.Repo.OwnerName}}/{{.Repo.Alias}}">{{.Repo.OwnerName}}/{{.Repo.Alias}}</a> | |||
| </div> | |||
| <div class="three wide column text center nowrap" style="width: 15%!important;"> | |||
| {{if eq .JobType "DEBUG"}} | |||
| <div class="ui compact buttons"> | |||
| @@ -199,6 +199,7 @@ | |||
| {{$.i18n.Tr "repo.debug"}} | |||
| </a> | |||
| {{else}} | |||
| {{if not .BootFile}} | |||
| <a id="ai-debug-{{$JobID}}" | |||
| class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' | |||
| data-jobid="{{$JobID}}" | |||
| @@ -206,6 +207,7 @@ | |||
| {{$.i18n.Tr "repo.debug_again"}} | |||
| </a> | |||
| {{end}} | |||
| {{end}} | |||
| </form> | |||
| </div> | |||
| {{end}} | |||
| @@ -228,7 +230,7 @@ | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{$JobID}}/stop' | |||
| data-jobid="{{$JobID}}"> | |||
| data-jobid="{{$JobID}}" data-bootfile="{{.BootFile}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </form> | |||
| @@ -236,7 +238,7 @@ | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "STOPPED" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 1}}modelarts/inference-job{{else}}cloudbrain/train-job{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}modelarts/train-job{{else if eq .Cloudbrain.Type 0}}cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}grampus/train-job{{end}}{{end}}' | |||
| data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
| data-jobid="{{$JobID}}" data-version="{{.VersionName}}" data-bootfile="{{.BootFile}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| {{end}} | |||
| @@ -24,6 +24,8 @@ export default async function initCloudrain() { | |||
| const repoPath = job.dataset.repopath; | |||
| // const computeResource = job.dataset.resource | |||
| const versionname = job.dataset.version; | |||
| const bootfile = job.dataset.bootfile; | |||
| console.log("bootfile---",bootfile) | |||
| const status_text = $(`#${ID}-text`).text(); | |||
| const finalState = [ | |||
| "STOPPED", | |||
| @@ -99,11 +101,16 @@ export default async function initCloudrain() { | |||
| "SUCCEEDED", | |||
| ].includes(status) | |||
| ) { | |||
| $("#ai-debug-" + ID) | |||
| .removeClass("disabled") | |||
| .addClass("blue") | |||
| .text(debug_again_button) | |||
| .css("margin", "0"); | |||
| if (!bootfile) { | |||
| $("#ai-debug-" + ID) | |||
| .removeClass("disabled") | |||
| .addClass("blue") | |||
| .text(debug_again_button) | |||
| .css("margin", "0"); | |||
| } else { | |||
| $("#ai-debug-" + ID).remove() | |||
| } | |||
| } | |||
| if (["RUNNING", "WAITING"].includes(status)) { | |||
| $("#ai-stop-" + ID) | |||
| @@ -289,7 +296,8 @@ export default async function initCloudrain() { | |||
| assertDelete(this); | |||
| } | |||
| }); | |||
| function stopDebug(ID, stopUrl) { | |||
| function stopDebug(ID, stopUrl,bootFile) { | |||
| console.log("---------=-=-=-==--===") | |||
| $.ajax({ | |||
| type: "POST", | |||
| url: stopUrl, | |||
| @@ -301,11 +309,15 @@ export default async function initCloudrain() { | |||
| .addClass(res.status); | |||
| $("#" + ID + "-text").text(res.status); | |||
| if (res.status === "STOPPED") { | |||
| $("#ai-debug-" + ID) | |||
| .removeClass("disabled") | |||
| .addClass("blue") | |||
| .text(debug_again_button) | |||
| .css("margin", "0"); | |||
| if (!bootFile) { | |||
| $("#ai-debug-" + ID) | |||
| .removeClass("disabled") | |||
| .addClass("blue") | |||
| .text(debug_again_button) | |||
| .css("margin", "0"); | |||
| } else { | |||
| $("#ai-debug-" + ID).remove() | |||
| } | |||
| $("#ai-image-" + ID) | |||
| .removeClass("blue") | |||
| .addClass("disabled"); | |||
| @@ -344,7 +356,8 @@ export default async function initCloudrain() { | |||
| $(".ui.basic.ai_stop").click(function () { | |||
| const ID = this.dataset.jobid; | |||
| const repoPath = this.dataset.repopath; | |||
| stopDebug(ID, repoPath); | |||
| const bootFile = this.dataset.bootfile | |||
| stopDebug(ID, repoPath,bootFile); | |||
| }); | |||
| function stopVersion(version_name, ID, repoPath) { | |||
| @@ -200,8 +200,8 @@ export default { | |||
| }, | |||
| methods: { | |||
| handleClose(done) { | |||
| console.log("close") | |||
| this.initSelect = true | |||
| this.alertCb = false | |||
| }, | |||
| selectResource(index) { | |||
| this.getNotebookInfo() | |||
| @@ -244,7 +244,6 @@ export default { | |||
| }, | |||
| getCb2NotebookInfo(path,id){ | |||
| getCb2Notebook(path,id).then((res)=>{ | |||
| console.log(res) | |||
| if(res.status===200){ | |||
| if(res.data.JobStatus==="RUNNING"){ | |||
| this.btnStatus[2]=2 | |||
| @@ -257,32 +256,23 @@ export default { | |||
| }, | |||
| stopDebug(index){ | |||
| this.btnStatus[index]=3 | |||
| if(index===2){ | |||
| stopNotebook(this.deubgUrlNpuStop).then((res)=>{ | |||
| console.log(res) | |||
| if(res.data.result_code==='0'){ | |||
| this.btnStatus[index]=0 | |||
| Message.success("停止任务成功") | |||
| }else{ | |||
| Message.error(res.data.error_msg) | |||
| } | |||
| }) | |||
| }else{ | |||
| stopNotebook(this.deubgUrlGpuStop).then((res)=>{ | |||
| console.log(res) | |||
| }) | |||
| } | |||
| let url = index===2 ? this.deubgUrlNpuStop :this.deubgUrlGpuStop | |||
| stopNotebook(url).then((res)=>{ | |||
| if(res.data.result_code==='0'){ | |||
| this.btnStatus[index]=0 | |||
| Message.success("停止任务成功") | |||
| }else{ | |||
| Message.error(res.data.error_msg) | |||
| } | |||
| }) | |||
| }, | |||
| createTask(index){ | |||
| this.btnStatus[index]=1 | |||
| const data = {type:index,...this.fileInfo} | |||
| let repoPath = `repos/${this.fileInfo.owner_name}/${this.fileInfo.project_name}` | |||
| createNotebook(data).then((res)=>{ | |||
| console.log("=========",res) | |||
| if(res.data.code===0 && res.status===200){ | |||
| // this.btnStatus[index]=2 | |||
| if(index===2){ | |||
| console.log("index",index) | |||
| timerCb2 = setInterval(() => { | |||
| setTimeout(this.getCb2NotebookInfo(repoPath,res.data.message), 0) | |||
| }, 10000) | |||
| @@ -296,10 +286,12 @@ export default { | |||
| }else if(res.data.code===1 && res.status===403){ | |||
| this.btnStatus[index]=0 | |||
| }else if(res.data.code==2){ | |||
| this.btnStatus[index]=0 | |||
| this.alertCb = true | |||
| }else{ | |||
| this.btnStatus[index]=0 | |||
| Message.error(res.data.message) | |||
| this.alertCb = true | |||
| } | |||
| }).catch((err)=>{ | |||
| this.btnStatus[index]=0 | |||
| @@ -332,14 +324,11 @@ export default { | |||
| }, | |||
| mounted() { | |||
| this.getNotebookInfo() | |||
| // this.dialogVisible = true | |||
| 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") | |||