|
|
@@ -158,7 +158,7 @@ td, th { |
|
|
|
<a href="javascript:window.history.back();"><i class="arrow left icon"></i>返回</a> |
|
|
|
</h4> |
|
|
|
{{range $k ,$v := .version_list_task}} |
|
|
|
<div class="ui accordion border-according"> |
|
|
|
<div class="ui accordion border-according" id="accordion{{.VersionName}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> |
|
|
|
<div class="title padding0"> |
|
|
|
<div class="according-panel-heading"> |
|
|
|
<div class="accordion-panel-title"> |
|
|
@@ -166,11 +166,11 @@ td, th { |
|
|
|
<span class="accordion-panel-title-content"> |
|
|
|
<span> |
|
|
|
<div style="float: right;"> |
|
|
|
<a class="ti-action-menu-item">创建模型</a> |
|
|
|
<a class="ti-action-menu-item {{if ne .Status "COMPLETED"}}disabled {{end}}">创建模型</a> |
|
|
|
<a class="ti-action-menu-item" href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">修改</a> |
|
|
|
<a class="ti-action-menu-item {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}" onclick="stopVersion({{.VersionName}})">停止</a> |
|
|
|
<a class="ti-action-menu-item {{if ne .Status "COMPLETED"}}disabled {{end}}" href="{{$.Link}}/models?version_name={{.VersionName}}" target="_blank">模型下载</a> |
|
|
|
<a class="ti-action-menu-item {{if ne .Status "COMPLETED"}}disabled {{end}}" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">删除</a> |
|
|
|
<a class="ti-action-menu-item {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}" id="{{.VersionName}}-stop" onclick="stopVersion({{.VersionName}})">停止</a> |
|
|
|
<a class="ti-action-menu-item " href="{{$.Link}}/models?version_name={{.VersionName}}" target="_blank">模型下载</a> |
|
|
|
<a class="ti-action-menu-item" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">删除</a> |
|
|
|
</div> |
|
|
|
<div class="ac-display-inblock title_text acc-margin-bottom"> |
|
|
|
|
|
|
@@ -408,6 +408,26 @@ td, th { |
|
|
|
</div> |
|
|
|
{{end}} |
|
|
|
</div> |
|
|
|
<!-- 确认模态框 --> |
|
|
|
<div id="deletemodel"> |
|
|
|
<div class="ui basic modal"> |
|
|
|
<div class="ui icon header"> |
|
|
|
<i class="trash icon"></i> 删除任务 |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="content"> |
|
|
|
<p>你确认删除该任务么?此任务一旦删除不可恢复。</p> |
|
|
|
</div> |
|
|
|
<div class="actions"> |
|
|
|
<div class="ui red basic inverted cancel button"> |
|
|
|
<i class="remove icon"></i> 取消操作 |
|
|
|
</div> |
|
|
|
<div class="ui green basic inverted ok button"> |
|
|
|
<i class="checkmark icon"></i> 确定操作 |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{template "base/footer" .}} |
|
|
|
|
|
|
@@ -442,7 +462,36 @@ td, th { |
|
|
|
e.cancelBubble = true; //ie兼容 |
|
|
|
} |
|
|
|
} |
|
|
|
// var timeid = window.setInterval(refreshStatus(version_name), 30000); |
|
|
|
// document.ready(refreshStatus(version_name)) |
|
|
|
|
|
|
|
function loadJobStatus() { |
|
|
|
$(".ui.accordion.border-according").each((index, job) => { |
|
|
|
const jobID = job.dataset.jobid; |
|
|
|
const repoPath = job.dataset.repopath; |
|
|
|
const versionname = job.dataset.version |
|
|
|
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 |
|
|
|
} |
|
|
|
|
|
|
|
$.get(`/api/v1/repos/${repoPath}/modelarts/train-job/${jobID}?version_name=${versionname}`, (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) |
|
|
|
|
|
|
|
// } |
|
|
|
}).fail(function(err) { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function refreshStatus(version_name){ |
|
|
|
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`,(data)=>{ |
|
|
|
console.log(data) |
|
|
@@ -461,16 +510,39 @@ td, th { |
|
|
|
stopBubbling(arguments.callee.caller.arguments[0]) |
|
|
|
} |
|
|
|
function deleteVersion(version_name){ |
|
|
|
$.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/del_version`,{version_name:version_name}).fail(function(err) { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
stopBubbling(arguments.callee.caller.arguments[0]) |
|
|
|
let flag = 1; |
|
|
|
$('.ui.basic.modal').modal({ |
|
|
|
onDeny: function() { |
|
|
|
flag = false |
|
|
|
}, |
|
|
|
onApprove: function() { |
|
|
|
$.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/del_version`,{version_name:version_name},(data)=>{ |
|
|
|
$('#accordion'+version_name).remove() |
|
|
|
}).fail(function(err) { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
flag = true |
|
|
|
}, |
|
|
|
onHidden: function() { |
|
|
|
if (flag == false) { |
|
|
|
$('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.modal('show') |
|
|
|
|
|
|
|
} |
|
|
|
function stopVersion(version_name){ |
|
|
|
$.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/stop_version`,{version_name:version_name}).fail(function(err) { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
stopBubbling(arguments.callee.caller.arguments[0]) |
|
|
|
$.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/stop_version`,{version_name:version_name},(data)=>{ |
|
|
|
if(data.StatusOK===0){ |
|
|
|
$('#'+version_name+'-stop').addClass('disabled') |
|
|
|
refreshStatus(version_name) |
|
|
|
} |
|
|
|
}).fail(function(err) { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
} |
|
|
|
function loadLog(version_name){ |
|
|
|
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&lines=20&order=asc`, (data) => { |
|
|
@@ -481,13 +553,13 @@ td, th { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
} |
|
|
|
function loadModelFile(version_name){ |
|
|
|
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/model_list?version_name=${version_name}&lines=20&order=asc`, (data) => { |
|
|
|
console.log(data) |
|
|
|
}).fail(function(err) { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
} |
|
|
|
// function loadModelFile(version_name){ |
|
|
|
// $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/model_list?version_name=${version_name}&lines=20&order=asc`, (data) => { |
|
|
|
// console.log(data) |
|
|
|
// }).fail(function(err) { |
|
|
|
// console.log(err); |
|
|
|
// }); |
|
|
|
// } |
|
|
|
$(".log").scroll(function () { |
|
|
|
var scrollTop = $(this)[0].scrollTop; // 滚动距离 |
|
|
|
var scrollHeight = $(this)[0].scrollHeight; // 文档高度 |
|
|
|