Browse Source

log file

tags/v1.21.12.1
zhoupzh 4 years ago
parent
commit
50a44289a1
1 changed files with 170 additions and 84 deletions
  1. +170
    -84
      templates/repo/modelarts/trainjob/show.tmpl

+ 170
- 84
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -83,6 +83,7 @@
.ti-text-form-label {
padding-bottom: 20px;
padding-right: 20px;
color: #8a8e99;
font-size: 12px;
white-space: nowrap;
@@ -105,6 +106,36 @@ td, th {
text-overflow: ellipsis;
white-space: nowrap;
}
.redo-color{
color: #3291F8;
}
.ti-action-menu-item:not(:last-child){
margin-right: 10px;
padding-right: 11px;
text-decoration: none!important;
color: #526ecc;
cursor: pointer;
display: inline-block;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
user-select: none;
position: relative;
}
.ti-action-menu-item:not(:last-child):after {
content: "";
display: inline-block;
position: absolute;
height: 12px;
right: 0;
top: 50%;
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
-o-transform: translateY(-6px);
transform: translateY(-6px);
border-right: 1px solid #dfe1e6;
}

</style>
<div class="repository">
@@ -113,7 +144,7 @@ td, th {
<h4 class="ui header" id="vertical-segment">
<a href="javascript:window.history.back();"><i class="arrow left icon"></i>返回</a>
</h4>
{{range .version_list_task}}
{{range $k ,$v := .version_list_task}}
<div class="ui accordion">
<div class="title padding0">
<div class="according-panel-heading">
@@ -122,21 +153,22 @@ td, th {
<span class="accordion-panel-title-content">
<span>
<div style="float: right;">
<button>创建模型</button>
<a href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">修改</a>
<button>停止</button>
<button>删除</button>
<a class="ti-action-menu-item">创建模型</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">停止</a>
<a class="ti-action-menu-item" style="color: #FF4D4F;">删除</a>
</div>
<div class="ac-display-inblock title_text acc-margin-bottom">
<span class="cti-mgRight-sm">2021/11/08 19:35:19</span>
<span class="cti-mgRight-sm"> 当前版本:{{.VersionName}}</span>
<span class="cti-mgRight-sm"> 父版本:{{.FatherVersionName}}</span>
<span class="cti-mgRight-sm ac-text-normal title_text">状态
<span><i id="icon" style="vertical-align: middle;" class=""></i><span id="text" style="margin-left: 0.4em;font-size: 12px;">运行成功</span></span>
<span class="cti-mgRight-sm ac-text-normal title_text">状态
<span><i id="icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span>
</span>
<span class="ac-text-normal title_text">运行时间:</span>
<span class="cti-mgRight-sm uc-accordionTitle-black">01:09:50</span>
<span data-tooltip="刷新" data-inverted="" onclick="refreshStatus({{.VersionName}})"><i class="redo icon"></i></span>
<span class="cti-mgRight-sm uc-accordionTitle-black">{{.TrainJobDuration}}</span>
<span data-tooltip="刷新" data-inverted="" onclick="refreshStatus({{.VersionName}})"><i class="redo icon redo-color"></i></span>

</div>
</span>
@@ -147,11 +179,11 @@ td, th {
<div class="content accordion-border">
<div class="content-pad">
<div class="ui pointing secondary menu">
<a class="active item" data-tab="first">配置信息</a>
<a class="item" data-tab="second">日志文件</a>
<a class="item" data-tab="third">模型下载</a>
<a class="active item" data-tab="first{{$k}}">配置信息</a>
<a class="item" data-tab="second{{$k}}" onclick="loadLog({{.VersionName}})">日志文件</a>
<a class="item" data-tab="third{{$k}}">模型下载</a>
</div>
<div class="ui tab" data-tab="first">
<div class="ui tab active" data-tab="first{{$k}}">
<div style="padding-top: 10px;">
<div class="tab_2_content">
<div class="ac-grid ac-grid-col2">
@@ -170,26 +202,37 @@ td, th {
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
状态
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.Status}}
</div>
</td>
<td class="ti-no-ng-animate ti-text-form-label">
状态
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.Status}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
运行版本
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
aaa
</div>
</td>
<td class="ti-no-ng-animate ti-text-form-label">
运行版本
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.VersionName}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
开始时间
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
空白
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
@@ -198,79 +241,112 @@ td, th {
<td class="ti-text-form-content">
<div class="text-span text-span-w">
aaa
{{.TrainJobDuration}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
规格
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.FlavorName}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
计算节点
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.WorkServerNumber}}
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="ac-grid-col">
<table class="ti-form">
<tbody class="ti-text-form">
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
资源池
AI引擎
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
aaa
{{.EngineName}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
规格
代码分支
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
aaa
{{.BranchName}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
计算节点
启动文件
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
1
{{.BootFile}}
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="ac-grid-col">
<table class="ti-form">
<tbody class="ti-text-form">
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
作业名称
训练数据集
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
trainjob-d672 | job15b681bc
{{.DatasetName}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
作业名称
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
trainjob-d672 | job15b681bc
</div>
</td>
<td class="ti-no-ng-animate ti-text-form-label">
运行参数
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.Parameters}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
作业名称
训练输出位置
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.TrainUrl}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label">
描述
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
trainjob-d672 | job15b681bc
<!-- {{.TrainUrl}} -->
</div>
</td>
</tr>
@@ -282,28 +358,32 @@ td, th {
</div>
</div>
<div class="ui tab" data-tab="second">
<div class="ui tab" data-tab="second{{$k}}">
<div>
<div class="ui message" style="display: none;">
<div class="header"></div>
<div id="header"></div>
</div>
<div class="ui top attached segment" style="background: #f0f0f0;">
<div class="center aligned">
<label>{{$.i18n.Tr "repo.modelarts.log"}}:</label>
<!-- <span class="fitted file_name"></span>
<input type="hidden" name="file_name" value>
<!-- <span class="fitted file_name">{{.}}</span> -->
<!-- <input type="hidden" name="file_name" value>
<input type="hidden" name="start_line" value>
<input type="hidden" name="end_line" value> -->
</div>
</div>
<div class="ui attached segment log" style="height: 300px !important; overflow: auto;">
<pre></pre>
<input type="hidden" class="version_name" name="version_name" value={{.VersionName}}>
<input type="hidden" name="end_line" value>
<input type="hidden" name="start_line" value>
<pre id="log_file{{.VersionName}}"></pre>
</div>
</div>
</div>
<div class="ui tab" data-tab="third">
<div class="ui tab" data-tab="third{{$k}}">
<div class="content-pad">
asdasd
</div>
@@ -340,7 +420,6 @@ td, th {
repoPath = urlArr.slice(-4)[0]
jobID = urlArr.slice(-1)[0]
})

function stopBubbling(e) {
e = window.event || e;
if (e.stopPropagation) {
@@ -350,22 +429,29 @@ td, th {
}
}
function refreshStatus(version_name){
console.log("----click get request------",version_name)
$.get(`/api/v1/repos/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`)
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`)
stopBubbling(arguments.callee.caller.arguments[0])
}
function loadLog(version_name){
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&lines=20&order=asc`, (data) => {
$('input[name=end_line]').val(data.EndLine)
$('input[name=start_line]').val(data.StartLine)
$(`#log_file${version_name}`).text(data.Content)
}).fail(function(err) {
console.log(err);
});
}
$(".log").scroll(function () {
var scrollTop = $(this)[0].scrollTop; // 滚动距离
var scrollHeight = $(this)[0].scrollHeight; // 文档高度
var divHeight = $(this).height(); // 可视区高度
var file_name = $('input[name=file_name]').val()

if(parseInt(scrollTop) + divHeight + 29 == scrollHeight){
let version_name=$(this).find('input[name=version_name]').val()
if(parseInt(scrollTop) + divHeight + 18 == scrollHeight){
var end_line = $('input[name=end_line]').val()
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?file_name=${file_name}&base_line=${end_line}&order=desc`, (data) => {
if (data.lines == 0){
$('.header').text('您已翻阅至日志底部')
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&order=desc`, (data) => {
if (data.Lines == 0){
$('#header').text('您已翻阅至日志底部')
$('.message').css('display', 'block')
setTimeout(function(){
$('.message').css('display', 'none')
@@ -380,9 +466,9 @@ td, th {
}
if(scrollTop == 0){
var start_line = $('input[name=start_line]').val()
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?file_name=${file_name}&base_line=${start_line}&order=asc`, (data) => {
if (data.lines == 0){
$('.header').text('您已翻阅至日志顶部')
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${start_line}&order=asc`, (data) => {
if (data.Lines == 0){
$('#header').text('您已翻阅至日志顶部')
$('.message').css('display', 'block')
setTimeout(function(){
$('.message').css('display', 'none')


Loading…
Cancel
Save