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