Browse Source

show job

tags/v1.22.3.2^2
lewis 3 years ago
parent
commit
91e4910a6f
2 changed files with 69 additions and 3 deletions
  1. +1
    -0
      routers/repo/cloudbrain.go
  2. +68
    -3
      templates/repo/cloudbrain/trainjob/show.tmpl

+ 1
- 0
routers/repo/cloudbrain.go View File

@@ -483,6 +483,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
version_list_task = append(version_list_task, task) version_list_task = append(version_list_task, task)
ctx.Data["version_list_task"] = version_list_task ctx.Data["version_list_task"] = version_list_task
ctx.Data["debugListType"] = debugListType ctx.Data["debugListType"] = debugListType
ctx.Data["canDownload"] = cloudbrain.CanDeleteJob(ctx, task)
ctx.HTML(200, tpName) ctx.HTML(200, tpName)
} }




+ 68
- 3
templates/repo/cloudbrain/trainjob/show.tmpl View File

@@ -179,8 +179,8 @@ td, th {
{{.i18n.Tr "repo.cloudbrain"}} {{.i18n.Tr "repo.cloudbrain"}}
</a> </a>
<div class="divider"> / </div> <div class="divider"> / </div>
<a class="section" href="{{$.RepoLink}}/cloudbrain/benchmark">
{{$.i18n.Tr "repo.modelarts.evaluate_job"}}
<a class="section" href="{{$.RepoLink}}/modelarts/train-job">
{{$.i18n.Tr "repo.modelarts.train_job"}}
</a> </a>
<div class="divider"> / </div> <div class="divider"> / </div>
<div class="active section">{{.displayJobName}}</div> <div class="active section">{{.displayJobName}}</div>
@@ -413,6 +413,8 @@ td, th {
let userName let userName
let repoPath let repoPath
let jobName let jobName
let downlaodFlag = {{$.canDownload}}
let taskID = {{$.task.ID}}
$(document).ready(function(){ $(document).ready(function(){
let url = window.location.href; let url = window.location.href;
let urlArr = url.split('/') let urlArr = url.split('/')
@@ -420,10 +422,20 @@ td, th {
repoPath = urlArr.slice(-4)[0] repoPath = urlArr.slice(-4)[0]
jobName = urlArr.slice(-1)[0] jobName = urlArr.slice(-1)[0]
}) })
function stopBubbling(e) {
e = window.event || e;
if (e.stopPropagation) {
e.stopPropagation(); //阻止事件 冒泡传播
} else {
e.cancelBubble = true; //ie兼容
}
}
let timeid = window.setInterval(loadJobStatus, 30000);
$(document).ready(loadJobStatus);


function loadLog(version_name){ function loadLog(version_name){
document.getElementById("mask").style.display = "block" document.getElementById("mask").style.display = "block"
$.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobName}/log?version_name=${version_name}&lines=50&order=asc`, (data) => {
$.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => {
$('input[name=end_line]').val(data.EndLine) $('input[name=end_line]').val(data.EndLine)
$('input[name=start_line]').val(data.StartLine) $('input[name=start_line]').val(data.StartLine)
$(`#log_file${version_name}`).text(data.Content) $(`#log_file${version_name}`).text(data.Content)
@@ -548,5 +560,58 @@ td, th {
size=size.toFixed(0);//保留的小数位数 size=size.toFixed(0);//保留的小数位数
return size+unitArr[index]; return size+unitArr[index];
} }
function loadJobStatus() {
$(".ui.accordion.border-according").each((index, job) => {
const jobID = job.dataset.jobid;
const repoPath = job.dataset.repopath;
const versionname = job.dataset.version
// ['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED']
// if (job.textContent.trim() == 'IMAGE_FAILED' || job.textContent.trim() == 'SUBMIT_FAILED' || job.textContent.trim() == 'DELETE_FAILED'
// || job.textContent.trim() == 'KILLED' || job.textContent.trim() == 'COMPLETED' || job.textContent.trim() == 'FAILED'
// || job.textContent.trim() == 'CANCELED' || job.textContent.trim() == 'LOST') {
// return
// }
let status = $(`#${versionname}-status-span`).text()
if(['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED','SUCCEEDED'].includes(status)){
return
}
let stopArray=["KILLED","FAILED","START_FAILED","KILLING","COMPLETED","SUCCEEDED"]
$.get(`/api/v1/repos/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => {
//$(`#${versionname}-duration-span`).text(data.JobDuration)
$(`#${versionname}-status-span span`).text(data.JobStatus)
$(`#${versionname}-status-span i`).attr("class",data.JobStatus)
// detail status and duration
//$('#'+versionname+'-duration').text(data.JobDuration)
$('#'+versionname+'-status').text(data.JobStatus)
if(stopArray.includes(data.JobStatus)){
$('#'+versionname+'-stop').addClass('disabled')
}
if(data.JobStatus==="COMPLETED"){
$('#'+versionname+'-create-model').removeClass('disabled').addClass('blue')
}
}).fail(function(err) {
console.log(err);
});
});
};

function refreshStatus(version_name){
$.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`,(data)=>{
// header status and duration
//$(`#${version_name}-duration-span`).text(data.JobDuration)
$(`#${version_name}-status-span span`).text(data.JobStatus)
$(`#${version_name}-status-span i`).attr("class",data.JobStatus)
// detail status and duration
//$('#'+version_name+'-duration').text(data.JobDuration)
$('#'+version_name+'-status').text(data.JobStatus)
loadLog(version_name)


}).fail(function(err) {
console.log(err);
});
stopBubbling(arguments.callee.caller.arguments[0])
}
</script> </script>

Loading…
Cancel
Save