diff --git a/templates/repo/cloudbrain/benchmark/index.tmpl b/templates/repo/cloudbrain/benchmark/index.tmpl index 165c8d463..ffce14870 100644 --- a/templates/repo/cloudbrain/benchmark/index.tmpl +++ b/templates/repo/cloudbrain/benchmark/index.tmpl @@ -253,29 +253,53 @@ } } - // 加载任务状态 + // 加载任务状态 var timeid = window.setInterval(loadJobStatus, 15000); $(document).ready(loadJobStatus); function loadJobStatus() { $(".job-status").each((index, job) => { - const jobID = job.dataset.jobid - const repoPath = job.dataset.repopath - const versionname = job.dataset.version - const status_text = $(`#${jobID}-text`).text() - if(['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED'].includes(status_text)){ - return + const jobID = job.dataset.jobid; + const repoPath = job.dataset.repopath; + const computeResource = job.dataset.resource + const initArray = ['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED'] + if (initArray.includes(job.textContent.trim())) { + + return } - $.get(`/api/v1/repos/${repoPath}/modelarts/train-job/${jobID}?version_name=${versionname}`, (data) => { + const diffResource = computeResource == "NPU" ? 'modelarts/notebook' : 'cloudbrain' + $.get(`/api/v1/repos/${repoPath}/${diffResource}/${jobID}`, (data) => { const jobID = data.JobID const status = data.JobStatus - const duration = data.JobDuration - $('#duration-'+jobID).text(duration) if (status != job.textContent.trim()) { $('#' + jobID+'-icon').removeClass().addClass(status) $('#' + jobID+ '-text').text(status) - } - + if(status==="RUNNING"){ + $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") + $('#model-image-'+jobID).removeClass('disabled').addClass('blue') + } + if(status!=="RUNNING"){ + // $('#model-debug-'+jobID).removeClass('blue') + // $('#model-debug-'+jobID).addClass('disabled') + $('#model-image-'+jobID).removeClass('blue').addClass('disabled') + } + if(["CREATING","STOPPING","WAITING","STARTING"].includes(status)){ + $('#model-debug-'+jobID).removeClass('blue').addClass('disabled') + } + if(['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED'].includes(status)){ + $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") + } + if(["RUNNING","WAITING"].includes(status)){ + $('#stop-model-debug-'+jobID).removeClass('disabled').addClass('blue') + } + if(["CREATING","STOPPING","STARTING","STOPPED","FAILED","START_FAILED","SUCCEEDED"].includes(status)){ + $('#stop-model-debug-'+jobID).removeClass('blue').addClass('disabled') + } + if(status==="STOPPED" || status==="FAILED"|| status==="START_FAILED"){ + $('#model-delete-'+jobID).removeClass('disabled').addClass('blue') + }else{ + $('#model-delete-'+jobID).removeClass('blue').addClass('disabled') + } }).fail(function(err) { console.log(err); }); diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl index a295d067e..49e54737f 100644 --- a/templates/repo/cloudbrain/benchmark/new.tmpl +++ b/templates/repo/cloudbrain/benchmark/new.tmpl @@ -75,8 +75,9 @@