| @@ -3,7 +3,7 @@ | |||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| <input type="hidden" id="postPath" value="{{.Link}}"> | <input type="hidden" id="postPath" value="{{.Link}}"> | ||||
| <div style="width: 80%;margin: auto;"> | |||||
| <div> | |||||
| <h4 class="ui top attached header"> | <h4 class="ui top attached header"> | ||||
| {{$.i18n.Tr "dataset.upload_dataset_file"}} | {{$.i18n.Tr "dataset.upload_dataset_file"}} | ||||
| </h4> | </h4> | ||||
| @@ -54,7 +54,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div style="width: 80%;margin: auto;padding-top: 2em;"> | |||||
| <div style="padding-top: 2em;"> | |||||
| <!-- <p>说明:<br> | <!-- <p>说明:<br> | ||||
| - 只有<span class="text blue">zip格式</span>zip格式的数据集才能发起云脑任务;<br> | - 只有<span class="text blue">zip格式</span>zip格式的数据集才能发起云脑任务;<br> | ||||
| - 云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。 | - 云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。 | ||||
| @@ -272,6 +272,8 @@ | |||||
| class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span> | class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span> | ||||
| <span class="cti-mgRight-sm uc-accordionTitle-black" | <span class="cti-mgRight-sm uc-accordionTitle-black" | ||||
| id="{{.VersionName}}-duration-span">{{$.duration}}</span> | id="{{.VersionName}}-duration-span">{{$.duration}}</span> | ||||
| <span id="refresh-status" data-tooltip="刷新" style="cursor: pointer;" data-inverted="" data-version="{{.VersionName}}"><i | |||||
| class="redo icon redo-color"></i></span> | |||||
| </div> | </div> | ||||
| </span> | </span> | ||||
| @@ -289,10 +289,8 @@ | |||||
| <div class="content-pad"> | <div class="content-pad"> | ||||
| <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);"> | <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);"> | ||||
| <a class="active item" | |||||
| data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||||
| <a class="item" data-tab="second{{$k}}" | |||||
| onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||||
| <a class="active item" data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||||
| <a class="item log_bottom" data-tab="second{{$k}}" data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||||
| <a class="item load-model-file" data-tab="third{{$k}}" data-download-flag="{{$.canDownload}}" data-path="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/model_list" data-version="{{.VersionName}}" data-parents="" data-filename="" data-init="init" >{{$.i18n.Tr "repo.model_download"}}</a> | <a class="item load-model-file" data-tab="third{{$k}}" data-download-flag="{{$.canDownload}}" data-path="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/model_list" data-version="{{.VersionName}}" data-parents="" data-filename="" data-init="init" >{{$.i18n.Tr "repo.model_download"}}</a> | ||||
| </div> | </div> | ||||
| <div class="ui tab active" data-tab="first{{$k}}"> | <div class="ui tab active" data-tab="first{{$k}}"> | ||||
| @@ -477,11 +475,23 @@ | |||||
| </div> | </div> | ||||
| <div class="ui tab" data-tab="second{{$k}}"> | <div class="ui tab" data-tab="second{{$k}}"> | ||||
| <div style="position: relative;"> | <div style="position: relative;"> | ||||
| <span> | |||||
| <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" | |||||
| class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a> | |||||
| </span> | |||||
| <span class="log-info"> | |||||
| <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;" | |||||
| class="log_bottom" data-version="{{.VersionName}}"><i | |||||
| class="icon-to-bottom"></i></a> | |||||
| </span> | |||||
| <div class="ui message message{{.VersionName}}" style="display: none;"> | <div class="ui message message{{.VersionName}}" style="display: none;"> | ||||
| <div id="header"></div> | <div id="header"></div> | ||||
| </div> | </div> | ||||
| <div class="ui attached log" id="log{{.VersionName}}" | |||||
| <div class="ui attached log" id="log{{.VersionName}}" | |||||
| style="height: 300px !important; overflow: auto;"> | style="height: 300px !important; overflow: auto;"> | ||||
| <div class="ui inverted active dimmer"> | |||||
| <div class="ui loader"></div> | |||||
| </div> | |||||
| <input type="hidden" name="end_line" value> | <input type="hidden" name="end_line" value> | ||||
| <input type="hidden" name="start_line" value> | <input type="hidden" name="start_line" value> | ||||
| <pre id="log_file{{.VersionName}}"></pre> | <pre id="log_file{{.VersionName}}"></pre> | ||||
| @@ -866,17 +876,4 @@ | |||||
| size = size.toFixed(0);//保留的小数位数 | size = size.toFixed(0);//保留的小数位数 | ||||
| return size + unitArr[index]; | return size + unitArr[index]; | ||||
| } | } | ||||
| function loadLog(version_name) { | |||||
| document.getElementById("mask").style.display = "block" | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/grampus/train-job/${jobID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { | |||||
| $('input[name=end_line]').val(data.EndLine) | |||||
| $('input[name=start_line]').val(data.StartLine) | |||||
| $(`#log_file${version_name}`).text(data.Content) | |||||
| document.getElementById("mask").style.display = "none" | |||||
| }).fail(function (err) { | |||||
| document.getElementById("mask").style.display = "none" | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| </script> | </script> | ||||
| @@ -463,7 +463,7 @@ td, th { | |||||
| <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" | <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" | ||||
| class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a> | class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a> | ||||
| </span> | </span> | ||||
| <span> | |||||
| <span class="log-info"> | |||||
| <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;" | <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;" | ||||
| class="log_bottom" data-version="{{.VersionName}}"><i | class="log_bottom" data-version="{{.VersionName}}"><i | ||||
| class="icon-to-bottom"></i></a> | class="icon-to-bottom"></i></a> | ||||
| @@ -472,6 +472,9 @@ td, th { | |||||
| <div id="header"></div> | <div id="header"></div> | ||||
| </div> | </div> | ||||
| <div class="ui attached log log-scroll" data-version="{{.VersionName}}" id="log{{.VersionName}}" style="height: 300px !important; overflow: auto;"> | <div class="ui attached log log-scroll" data-version="{{.VersionName}}" id="log{{.VersionName}}" style="height: 300px !important; overflow: auto;"> | ||||
| <div class="ui inverted active dimmer"> | |||||
| <div class="ui loader"></div> | |||||
| </div> | |||||
| <input type="hidden" name="end_line" value> | <input type="hidden" name="end_line" value> | ||||
| <input type="hidden" name="start_line" value> | <input type="hidden" name="start_line" value> | ||||
| <pre id="log_file{{.VersionName}}"></pre> | <pre id="log_file{{.VersionName}}"></pre> | ||||
| @@ -512,7 +512,7 @@ | |||||
| <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" | <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" | ||||
| class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a> | class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a> | ||||
| </span> | </span> | ||||
| <span> | |||||
| <span class="log-info"> | |||||
| <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;" | <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;" | ||||
| class="log_bottom" data-version="{{.VersionName}}"><i | class="log_bottom" data-version="{{.VersionName}}"><i | ||||
| class="icon-to-bottom"></i></a> | class="icon-to-bottom"></i></a> | ||||
| @@ -522,6 +522,9 @@ | |||||
| </div> | </div> | ||||
| <div class="ui attached log log-scroll" id="log{{.VersionName}}" data-version="{{.VersionName}}" | <div class="ui attached log log-scroll" id="log{{.VersionName}}" data-version="{{.VersionName}}" | ||||
| style="height: 300px !important; overflow: auto;"> | style="height: 300px !important; overflow: auto;"> | ||||
| <div class="ui inverted active dimmer"> | |||||
| <div class="ui loader"></div> | |||||
| </div> | |||||
| <input type="hidden" name="end_line" value> | <input type="hidden" name="end_line" value> | ||||
| <input type="hidden" name="start_line" value> | <input type="hidden" name="start_line" value> | ||||
| <pre id="log_file{{.VersionName}}"></pre> | <pre id="log_file{{.VersionName}}"></pre> | ||||
| @@ -905,154 +908,7 @@ | |||||
| } | } | ||||
| function loadLog(version_name) { | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { | |||||
| $('input[name=end_line]').val(data.EndLine) | |||||
| $('input[name=start_line]').val(data.StartLine) | |||||
| $(`#log_file${version_name}`).text(data.Content) | |||||
| if(!data.CanLogDownload){ | |||||
| $(`#${version_name}-log-down`).removeClass('ti-download-file').addClass('disabled') | |||||
| } | |||||
| }).fail(function (err) { | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| function debounce(fn, delay) { | |||||
| let timer; | |||||
| return (...args) => { | |||||
| // 判断定时器是否存在,清除定时器 | |||||
| if (timer) { | |||||
| clearTimeout(timer); | |||||
| } | |||||
| // 重新调用setTimeout | |||||
| timer = setTimeout(() => { | |||||
| fn.apply(this, args); | |||||
| }, delay); | |||||
| }; | |||||
| } | |||||
| const fn = debounce(logScroll, 500) | |||||
| function logScroll(version_name) { | |||||
| let container = document.querySelector(`#log${version_name}`) | |||||
| let scrollTop = container.scrollTop | |||||
| let scrollHeight = container.scrollHeight | |||||
| let clientHeight = container.clientHeight | |||||
| let scrollLeft = container.scrollLeft | |||||
| if (((parseInt(scrollTop) + clientHeight == scrollHeight || parseInt(scrollTop) + clientHeight + 1 == scrollHeight || parseInt(scrollTop) + clientHeight - 1 == scrollHeight)) && parseInt(scrollTop) !== 0 && scrollLeft == 0) { | |||||
| let end_line = $(`#log${version_name} input[name=end_line]`).val() | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, (data) => { | |||||
| if (data.Lines == 0) { | |||||
| $(`.message${version_name} #header`).text('您已翻阅至日志底部') | |||||
| $(`.message${version_name}`).css('display', 'block') | |||||
| setTimeout(function () { | |||||
| $(`.message${version_name}`).css('display', 'none') | |||||
| }, 1000) | |||||
| } else { | |||||
| if (end_line === data.EndLine) { | |||||
| return | |||||
| } | |||||
| else { | |||||
| $(`#log${version_name} input[name=end_line]`).val(data.EndLine) | |||||
| $(`#log${version_name}`).append('<pre>' + data.Content) | |||||
| } | |||||
| } | |||||
| }).fail(function (err) { | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| if ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].includes(scrollTop) && scrollLeft == 0) { | |||||
| let start_line = $(`#log${version_name} input[name=start_line]`).val() | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${start_line}&lines=50&order=asc`, (data) => { | |||||
| if (data.Lines == 0) { | |||||
| $(`.message${version_name} #header`).text('您已翻阅至日志顶部') | |||||
| $(`.message${version_name}`).css('display', 'block') | |||||
| setTimeout(function () { | |||||
| $(`.message${version_name}`).css('display', 'none') | |||||
| }, 1000) | |||||
| } else { | |||||
| $(`#log${version_name} input[name=start_line]`).val(data.StartLine) //如果变动就改变所对应的值 | |||||
| $(`#log${version_name}`).prepend('<pre>' + data.Content) | |||||
| } | |||||
| }).fail(function (err) { | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| } | |||||
| function scrollAnimation(dom, currentY, targetY, currentX) { | |||||
| let needScrollTop = targetY - currentY; | |||||
| let _currentY = currentY; | |||||
| setTimeout(() => { | |||||
| // 一次调用滑动帧数,每次调用会不一样 | |||||
| //取总距离的十分之一 | |||||
| const dist = Math.ceil(needScrollTop / 10); | |||||
| _currentY += dist; | |||||
| //移动一个十分之一 | |||||
| dom.scrollTo(currentX || 0, _currentY, 'smooth'); | |||||
| // 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果 | |||||
| if (needScrollTop > 10 || needScrollTop < -10) { | |||||
| scrollAnimation(dom, _currentY, targetY) | |||||
| } else { | |||||
| dom.scrollTo(0, targetY, 'smooth') | |||||
| } | |||||
| }, 1) | |||||
| } | |||||
| $('.log_top').click(function () { | |||||
| // let logContentDom = document.querySelector('.log') | |||||
| // if(!logContentDom) | |||||
| // return | |||||
| // let version_name = $('.log_top').data('version') | |||||
| let version_name = $(this).data('version') | |||||
| let logContentDom = document.querySelector(`#log${version_name}`) | |||||
| $(`#log_file${version_name}`).siblings('pre').remove() | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=&lines=50&order=asc`, (data) => { | |||||
| $(`#log${version_name} input[name=end_line]`).val(data.EndLine) //如果变动就改变所对应的值 | |||||
| $(`#log${version_name} input[name=start_line]`).val(data.StartLine) | |||||
| $(`#log${version_name}`).prepend('<pre>' + data.Content) | |||||
| $(`.message${version_name} #header`).text('您已翻阅至日志顶部') | |||||
| $(`.message${version_name}`).css('display', 'block') | |||||
| setTimeout(function () { | |||||
| $(`.message${version_name}`).css('display', 'none') | |||||
| }, 1000) | |||||
| scrollAnimation(logContentDom, logContentDom.scrollTop, 0); | |||||
| }) | |||||
| }) | |||||
| $('.log_bottom').click(function (e) { | |||||
| let version_name = $(this).data('version') | |||||
| let logContentDom = document.querySelector(`#log${version_name}`) | |||||
| $(`#log_file${version_name}`).siblings('pre').remove() | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=&lines=50&order=desc`, (data) => { | |||||
| $(`#log${version_name} input[name=end_line]`).val(data.EndLine) //如果变动就改变所对应的值 | |||||
| $(`#log${version_name} input[name=start_line]`).val(data.StartLine) | |||||
| $(`#log${version_name}`).append('<pre>' + data.Content) | |||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${data.EndLine}&lines=50&order=desc`, (data) => { | |||||
| if (data.Lines == 0) { | |||||
| $(`.message${version_name} #header`).text('您已翻阅至日志底部') | |||||
| $(`.message${version_name}`).css('display', 'block') | |||||
| setTimeout(function () { | |||||
| $(`.message${version_name}`).css('display', 'none') | |||||
| }, 1000) | |||||
| } else { | |||||
| if (end_line === data.EndLine) { | |||||
| return | |||||
| } | |||||
| else { | |||||
| $(`#log${version_name} input[name=end_line]`).val(data.EndLine) | |||||
| $(`#log${version_name}`).append('<pre>' + data.Content) | |||||
| } | |||||
| } | |||||
| }).fail(function (err) { | |||||
| console.log(err); | |||||
| }); | |||||
| scrollAnimation(logContentDom, logContentDom.scrollTop + 1, logContentDom.scrollHeight - logContentDom.clientHeight); | |||||
| }) | |||||
| }) | |||||
| @@ -14,7 +14,7 @@ export default async function initCloudrainSow() { | |||||
| }; | }; | ||||
| } | } | ||||
| function logScroll(version_name) { | |||||
| function logScroll(version_name, repoPath, ID) { | |||||
| let container = document.querySelector(`#log${version_name}`); | let container = document.querySelector(`#log${version_name}`); | ||||
| let scrollTop = container.scrollTop; | let scrollTop = container.scrollTop; | ||||
| let scrollHeight = container.scrollHeight; | let scrollHeight = container.scrollHeight; | ||||
| @@ -28,7 +28,7 @@ export default async function initCloudrainSow() { | |||||
| ) { | ) { | ||||
| let end_line = $(`#log${version_name} input[name=end_line]`).val(); | let end_line = $(`#log${version_name} input[name=end_line]`).val(); | ||||
| $.get( | $.get( | ||||
| `/api/v1/repos/${userName}/${repoPath}/modelarts/inference-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, | |||||
| `/api/v1/repos/${repoPath}/${ID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, | |||||
| (data) => { | (data) => { | ||||
| if (data.Lines == 0) { | if (data.Lines == 0) { | ||||
| $(`.message${version_name} #header`).text("您已翻阅至日志底部"); | $(`.message${version_name} #header`).text("您已翻阅至日志底部"); | ||||
| @@ -52,7 +52,7 @@ export default async function initCloudrainSow() { | |||||
| if (scrollTop == 0 && scrollLeft == 0) { | if (scrollTop == 0 && scrollLeft == 0) { | ||||
| let start_line = $(`#log${version_name} input[name=start_line]`).val(); | let start_line = $(`#log${version_name} input[name=start_line]`).val(); | ||||
| $.get( | $.get( | ||||
| `/api/v1/repos/${userName}/${repoPath}/modelarts/inference-job/${jobID}/log?version_name=${version_name}&base_line=${start_line}&lines=50&order=asc`, | |||||
| `/api/v1/repos/${repoPath}/${ID}/log?version_name=${version_name}&base_line=${start_line}&lines=50&order=asc`, | |||||
| (data) => { | (data) => { | ||||
| if (data.Lines == 0) { | if (data.Lines == 0) { | ||||
| $(`.message${version_name} #header`).text("您已翻阅至日志顶部"); | $(`.message${version_name} #header`).text("您已翻阅至日志顶部"); | ||||
| @@ -73,7 +73,9 @@ export default async function initCloudrainSow() { | |||||
| const fn = debounce(logScroll, 500); | const fn = debounce(logScroll, 500); | ||||
| $(".log-scroll").scroll(function () { | $(".log-scroll").scroll(function () { | ||||
| let version_name = $(this).data("version"); | let version_name = $(this).data("version"); | ||||
| fn(version_name); | |||||
| let ID = $(`#accordion${version_name}`).data("jobid"); | |||||
| let repoPath = $(`#accordion${version_name}`).data("repopath"); | |||||
| fn(version_name, repoPath, ID); | |||||
| }); | }); | ||||
| function scrollAnimation(dom, currentY, targetY, currentX) { | function scrollAnimation(dom, currentY, targetY, currentX) { | ||||
| let needScrollTop = targetY - currentY; | let needScrollTop = targetY - currentY; | ||||
| @@ -101,11 +103,14 @@ export default async function initCloudrainSow() { | |||||
| // let version_name = $('.log_top').data('version') | // let version_name = $('.log_top').data('version') | ||||
| let version_name = $(this).data("version"); | let version_name = $(this).data("version"); | ||||
| let logContentDom = document.querySelector(`#log${version_name}`); | let logContentDom = document.querySelector(`#log${version_name}`); | ||||
| let ID = $(`#accordion${version_name}`).data("jobid"); | |||||
| let repoPath = $(`#accordion${version_name}`).data("repopath"); | |||||
| $(`#log_file${version_name}`).siblings("pre").remove(); | $(`#log_file${version_name}`).siblings("pre").remove(); | ||||
| $(".ui.inverted.active.dimmer").css("display", "block"); | |||||
| $.get( | $.get( | ||||
| `/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=&lines=50&order=asc`, | |||||
| `/api/v1/repos/${repoPath}/${ID}/log?version_name=${version_name}&base_line=&lines=50&order=asc`, | |||||
| (data) => { | (data) => { | ||||
| $(".ui.inverted.active.dimmer").css("display", "none"); | |||||
| $(`#log${version_name} input[name=end_line]`).val(data.EndLine); //如果变动就改变所对应的值 | $(`#log${version_name} input[name=end_line]`).val(data.EndLine); //如果变动就改变所对应的值 | ||||
| $(`#log${version_name} input[name=start_line]`).val(data.StartLine); | $(`#log${version_name} input[name=start_line]`).val(data.StartLine); | ||||
| $(`#log${version_name}`).prepend("<pre>" + data.Content); | $(`#log${version_name}`).prepend("<pre>" + data.Content); | ||||
| @@ -121,10 +126,15 @@ export default async function initCloudrainSow() { | |||||
| $(".log_bottom").click(function (e) { | $(".log_bottom").click(function (e) { | ||||
| let version_name = $(this).data("version"); | let version_name = $(this).data("version"); | ||||
| let logContentDom = document.querySelector(`#log${version_name}`); | let logContentDom = document.querySelector(`#log${version_name}`); | ||||
| let ID = $(`#accordion${version_name}`).data("jobid"); | |||||
| let repoPath = $(`#accordion${version_name}`).data("repopath"); | |||||
| $(`#log_file${version_name}`).siblings("pre").remove(); | $(`#log_file${version_name}`).siblings("pre").remove(); | ||||
| let end_line = $(`#log${version_name} input[name=end_line]`).val(); | |||||
| $(".ui.inverted.active.dimmer").css("display", "block"); | |||||
| $.get( | $.get( | ||||
| `/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=&lines=50&order=desc`, | |||||
| `/api/v1/repos/${repoPath}/${ID}/log?version_name=${version_name}&base_line=&lines=50&order=desc`, | |||||
| (data) => { | (data) => { | ||||
| $(".ui.inverted.active.dimmer").css("display", "none"); | |||||
| if (!data.CanLogDownload) { | if (!data.CanLogDownload) { | ||||
| $(`#${version_name}-log-down`) | $(`#${version_name}-log-down`) | ||||
| .removeClass("ti-download-file") | .removeClass("ti-download-file") | ||||
| @@ -134,8 +144,9 @@ export default async function initCloudrainSow() { | |||||
| $(`#log${version_name} input[name=start_line]`).val(data.StartLine); | $(`#log${version_name} input[name=start_line]`).val(data.StartLine); | ||||
| $(`#log${version_name}`).append("<pre>" + data.Content); | $(`#log${version_name}`).append("<pre>" + data.Content); | ||||
| $.get( | $.get( | ||||
| `/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${data.EndLine}&lines=50&order=desc`, | |||||
| `/api/v1/repos/${repoPath}/${ID}/log?version_name=${version_name}&base_line=${data.EndLine}&lines=50&order=desc`, | |||||
| (data) => { | (data) => { | ||||
| $(".ui.inverted.active.dimmer").css("display", "none"); | |||||
| if (data.Lines == 0) { | if (data.Lines == 0) { | ||||
| $(`.message${version_name} #header`).text("您已翻阅至日志底部"); | $(`.message${version_name} #header`).text("您已翻阅至日志底部"); | ||||
| $(`.message${version_name}`).css("display", "block"); | $(`.message${version_name}`).css("display", "block"); | ||||
| @@ -143,7 +154,7 @@ export default async function initCloudrainSow() { | |||||
| $(`.message${version_name}`).css("display", "none"); | $(`.message${version_name}`).css("display", "none"); | ||||
| }, 1000); | }, 1000); | ||||
| } else { | } else { | ||||
| if (end_line === data.EndLine) { | |||||
| if (end_line === data.EndLine || end_line === "") { | |||||
| return; | return; | ||||
| } else { | } else { | ||||
| $(`#log${version_name} input[name=end_line]`).val(data.EndLine); | $(`#log${version_name} input[name=end_line]`).val(data.EndLine); | ||||
| @@ -163,6 +174,49 @@ export default async function initCloudrainSow() { | |||||
| ); | ); | ||||
| }); | }); | ||||
| function loadLog(version_name) { | |||||
| document.getElementById("mask").style.display = "block"; | |||||
| $.get( | |||||
| `/api/v1/repos/${userName}/${repoPath}/grampus/train-job/${jobID}/log?version_name=${version_name}&lines=50&order=asc`, | |||||
| (data) => { | |||||
| $("input[name=end_line]").val(data.EndLine); | |||||
| $("input[name=start_line]").val(data.StartLine); | |||||
| $(`#log_file${version_name}`).text(data.Content); | |||||
| document.getElementById("mask").style.display = "none"; | |||||
| } | |||||
| ).fail(function (err) { | |||||
| document.getElementById("mask").style.display = "none"; | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| $("#refresh-status").click(function (e) { | |||||
| let version_name = $(this).data("version"); | |||||
| let ID = $(`#accordion${version_name}`).data("jobid"); | |||||
| let repoPath = $(`#accordion${version_name}`).data("repopath"); | |||||
| refreshStatusShow(version_name, ID, repoPath); | |||||
| $(".log-info .log_bottom").trigger("click"); | |||||
| e.stopPropagation(); | |||||
| }); | |||||
| function refreshStatusShow(version_name, ID, repoPath) { | |||||
| $.get( | |||||
| `/api/v1/repos/${repoPath}/${ID}?version_name=${version_name}`, | |||||
| (data) => { | |||||
| //accroding下的状态 | |||||
| $(`#${version_name}-status-span span`).text(data.JobStatus); | |||||
| //accroding下的状态图标 | |||||
| $(`#${version_name}-status-span i`).attr("class", data.JobStatus); | |||||
| //accroding下的运行时长 | |||||
| $(`#${version_name}-duration-span`).text(data.JobDuration); | |||||
| //配置信息详情页的状态 | |||||
| $(`#${version_name}-status`).text(data.JobStatus); | |||||
| //配置信息详情页的状态 | |||||
| $(`#${version_name}-duration`).text(data.JobDuration); | |||||
| } | |||||
| ).fail(function (err) { | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| // | // | ||||
| $(".content-pad").on("click", ".load-model-file", function () { | $(".content-pad").on("click", ".load-model-file", function () { | ||||
| let downloadFlag = $(this).data("download-flag") || ""; | let downloadFlag = $(this).data("download-flag") || ""; | ||||
| @@ -175,8 +229,8 @@ export default async function initCloudrainSow() { | |||||
| let url = `/api/v1/repos${path}?version_name=${version_name}&parentDir=${parents}`; | let url = `/api/v1/repos${path}?version_name=${version_name}&parentDir=${parents}`; | ||||
| $.get(url, (data) => { | $.get(url, (data) => { | ||||
| $(`#dir_list${version_name}`).empty(); | $(`#dir_list${version_name}`).empty(); | ||||
| if(data.Dirs){ | |||||
| renderDir(path, data, version_name, downloadFlag, gpuFlag); | |||||
| if (data.Dirs) { | |||||
| renderDir(path, data, version_name, downloadFlag, gpuFlag); | |||||
| } | } | ||||
| if (init === "init") { | if (init === "init") { | ||||
| $(`input[name=model${version_name}]`).val(""); | $(`input[name=model${version_name}]`).val(""); | ||||
| @@ -191,7 +245,15 @@ export default async function initCloudrainSow() { | |||||
| htmlBread += "<div class='divider'> / </div>"; | htmlBread += "<div class='divider'> / </div>"; | ||||
| $(`#file_breadcrumb${version_name}`).append(htmlBread); | $(`#file_breadcrumb${version_name}`).append(htmlBread); | ||||
| } else { | } else { | ||||
| renderBrend(path, version_name, parents, filename, init, downloadFlag,gpuFlag); | |||||
| renderBrend( | |||||
| path, | |||||
| version_name, | |||||
| parents, | |||||
| filename, | |||||
| init, | |||||
| downloadFlag, | |||||
| gpuFlag | |||||
| ); | |||||
| } | } | ||||
| }).fail(function (err) { | }).fail(function (err) { | ||||
| console.log(err, version_name); | console.log(err, version_name); | ||||
| @@ -253,15 +315,15 @@ export default async function initCloudrainSow() { | |||||
| } else { | } else { | ||||
| $(`input[name=model${version_name}]`).val(parents); | $(`input[name=model${version_name}]`).val(parents); | ||||
| $(`input[name=modelback${version_name}]`).val(filename); | $(`input[name=modelback${version_name}]`).val(filename); | ||||
| $(`#file_breadcrumb${version_name} a.section:contains(${filename})`) | |||||
| .nextAll() | |||||
| .remove(); | |||||
| $( | |||||
| `#file_breadcrumb${version_name} a.section:contains(${filename})` | |||||
| ).replaceWith(`<div class='active section'>${filename}</div>`); | |||||
| $( | |||||
| `#file_breadcrumb${version_name} div.section:contains(${filename})` | |||||
| ).append("<div class='divider'> / </div>"); | |||||
| let selectEle = $(`#file_breadcrumb${version_name} a.section`).filter( | |||||
| (index, item) => { | |||||
| return item.text == filename; | |||||
| } | |||||
| ); | |||||
| selectEle.nextAll().remove(); | |||||
| selectEle.replaceWith(`<div class='active section'>${filename}</div>`); | |||||
| selectEle.append("<div class='divider'> / </div>"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -347,33 +347,7 @@ export default async function initCloudrain() { | |||||
| e.stopPropagation(); | e.stopPropagation(); | ||||
| }); | }); | ||||
| $("#refresh-status").click(function (e) { | |||||
| let version_name = $(this).data("version"); | |||||
| let ID = $(`#accordion${version_name}`).data("jobid"); | |||||
| let repoPath = $(`#accordion${version_name}`).data("repopath"); | |||||
| refreshStatusShow(version_name, ID, repoPath); | |||||
| e.stopPropagation(); | |||||
| }); | |||||
| function refreshStatusShow(version_name, ID, repoPath) { | |||||
| $.get( | |||||
| `/api/v1/repos/${repoPath}/${ID}?version_name=${version_name}`, | |||||
| (data) => { | |||||
| //accroding下的状态 | |||||
| $(`#${version_name}-status-span span`).text(data.JobStatus); | |||||
| //accroding下的状态图标 | |||||
| $(`#${version_name}-status-span i`).attr("class", data.JobStatus); | |||||
| //accroding下的运行时长 | |||||
| $(`#${version_name}-duration-span`).text(data.JobDuration); | |||||
| //配置信息详情页的状态 | |||||
| $(`#${version_name}-status`).text(data.JobStatus); | |||||
| //配置信息详情页的状态 | |||||
| $(`#${version_name}-duration`).text(data.JobDuration); | |||||
| } | |||||
| ).fail(function (err) { | |||||
| console.log(err); | |||||
| }); | |||||
| } | |||||
| function refreshStatus(version_name, ID, repoPath) { | function refreshStatus(version_name, ID, repoPath) { | ||||
| const url = `/api/v1/repos/${repoPath}/${ID}/?version_name${version_name}`; | const url = `/api/v1/repos/${repoPath}/${ID}/?version_name${version_name}`; | ||||
| $.get(url, (data) => { | $.get(url, (data) => { | ||||