Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1106 Reviewed-by: wangjr <wangjr@pcl.ac.cn>pull/1159/head
@@ -92,6 +92,7 @@ func DebugJobIndex(ctx *context.Context) { | |||
ctx.Data["PageIsCloudBrain"] = true | |||
ctx.Data["Tasks"] = ciTasks | |||
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | |||
ctx.Data["RepoIsEmpty"] = repo.IsEmpty | |||
ctx.HTML(200, tplDebugJobIndex) | |||
} | |||
@@ -331,6 +332,7 @@ func TrainJobIndex(ctx *context.Context) { | |||
ctx.Data["PageIsCloudBrain"] = true | |||
ctx.Data["Tasks"] = tasks | |||
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | |||
ctx.Data["RepoIsEmpty"] = repo.IsEmpty | |||
ctx.HTML(200, tplModelArtsTrainJobIndex) | |||
} | |||
@@ -258,7 +258,7 @@ | |||
<button class="ui green button" > | |||
{{.i18n.Tr "repo.cloudbrain.new"}} | |||
</button> | |||
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
<a class="ui button" href="{{.RepoLink}}/debugjob??debugListType=CPU/GPU">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
</div> | |||
</div> | |||
</form> | |||
@@ -272,8 +272,8 @@ | |||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> | |||
<script> | |||
let url_href = window.location.pathname.split('create')[0] | |||
$(".ui.button").attr('href',url_href) | |||
// let url_href = window.location.pathname.split('create')[0] | |||
// $(".ui.button").attr('href',url_href) | |||
let form = document.getElementById('form_id'); | |||
@@ -11,7 +11,7 @@ | |||
{{.i18n.Tr "repo.cloudbrain"}} | |||
</a> | |||
<div class="divider"> / </div> | |||
<a class="section" href="{{.RepoLink}}/debugjob?debugListType=CPU/GPU"> | |||
<a class="section backTodeBug" href="{{.RepoLink}}/debugjob?debugListType=CPU/GPU"> | |||
{{$.i18n.Tr "repo.modelarts.notebook"}} | |||
</a> | |||
<div class="divider"> / </div> | |||
@@ -98,3 +98,4 @@ | |||
</div> | |||
</div> | |||
{{template "base/footer" .}} | |||
@@ -239,10 +239,12 @@ | |||
<div class="ui icon header bgtask-header-pic"></div> | |||
<div class="bgtask-content-header">未创建过调试任务</div> | |||
<div class="bgtask-content"> | |||
{{if $.RepoIsEmpty}} | |||
<div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本</a>;</div> | |||
{{end}} | |||
<div class="bgtask-content-txt">运行时长:最长不超过4个小时,超过4个小时将自动停止;</div> | |||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境。</div> | |||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org/zeizei/OpenI_Learning">小白训练营课程</a></div> | |||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;</div> | |||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org.cn/zeizei/OpenI_Learning">小白训练营课程。</a></div> | |||
</div> | |||
</div> | |||
{{else}} | |||
@@ -464,6 +466,7 @@ | |||
let url={{.RepoLink}} | |||
let getParam=location.search.split('?debugListType=').pop() | |||
let dropdownValue = getParam==='all'||getParam==='' ? '全部' : getParam | |||
localStorage.setItem('all',location.href) | |||
function stop(obj) { | |||
if (obj.style.color != "rgb(204, 204, 204)") { | |||
obj.target = '_blank' | |||
@@ -618,4 +621,5 @@ | |||
} | |||
}) | |||
} | |||
</script> |
@@ -92,7 +92,7 @@ | |||
<button class="ui green button"> | |||
{{.i18n.Tr "repo.cloudbrain.new"}} | |||
</button> | |||
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
<a class="ui button" href="{{.RepoLink}}/debugjob??debugListType=CPU/GPU">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
</div> | |||
</div> | |||
</form> | |||
@@ -11,7 +11,7 @@ | |||
{{.i18n.Tr "repo.cloudbrain"}} | |||
</a> | |||
<div class="divider"> / </div> | |||
<a class="section" href="{{.RepoLink}}/debugjob?debugListType=NPU"> | |||
<a class="section backTodeBug" href="{{.RepoLink}}/debugjob?debugListType=NPU"> | |||
{{$.i18n.Tr "repo.modelarts.notebook"}} | |||
</a> | |||
<div class="divider"> / </div> | |||
@@ -49,9 +49,11 @@ | |||
<div class="ui icon header bgtask-header-pic"></div> | |||
<div class="bgtask-content-header">未创建过训练任务</div> | |||
<div class="bgtask-content"> | |||
<div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本</a>;</div> | |||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境。</div> | |||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org/zeizei/OpenI_Learning">小白训练营课程</a></div> | |||
{{if $.RepoIsEmpty}} | |||
<div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本;</a></div> | |||
{{end}} | |||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;</div> | |||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org/zeizei/OpenI_Learning">小白训练营课程。</a></div> | |||
</div> | |||
</div> | |||
{{else}} | |||
@@ -147,6 +147,7 @@ | |||
<span> | |||
<i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | |||
</span> | |||
<a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">查看样例</a> | |||
</div> | |||
<div class="required unite min_title inline field"> | |||
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.dataset"}}</label> | |||
@@ -159,6 +160,7 @@ | |||
<option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option> | |||
{{end}} | |||
</select> | |||
<span class="tooltips">数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。</span> | |||
</div> | |||
<div class="inline unite min_title field"> | |||
@@ -267,7 +269,6 @@ | |||
sever_num.val(parseInt(sever_num.val())+1) | |||
} | |||
}) | |||
// 参数增加、删除、修改、保存 | |||
function Add_parameter(i){ | |||
value = '<div class="two fields width85" id= "para'+ i +'">' + | |||
@@ -159,6 +159,7 @@ | |||
<span> | |||
<i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | |||
</span> | |||
<a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">查看样例</a> | |||
</div> | |||
<div class="required unite min_title inline field"> | |||
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.dataset"}}</label> | |||
@@ -173,6 +174,7 @@ | |||
{{end}} | |||
{{end}} | |||
</select> | |||
<span class="tooltips">数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。</span> | |||
</div> | |||
<div class="inline unite min_title field"> | |||
@@ -162,6 +162,7 @@ | |||
$("#job-name").empty() | |||
createModelName() | |||
loadTrainList() | |||
}, | |||
onHide:function(){ | |||
document.getElementById("formId").reset(); | |||
@@ -179,6 +180,7 @@ | |||
$('#choice_model').dropdown({ | |||
onChange:function(value){ | |||
$(".ui.dropdown.selection.search.width70").addClass("loading") | |||
$('#choice_version').dropdown('clear') | |||
$("#job-version").empty() | |||
loadTrainVersion(value) | |||
} | |||
@@ -208,11 +210,17 @@ | |||
train_html += '</div>' | |||
} | |||
$("#job-name").append(train_html) | |||
$(".ui.dropdown.selection.search.width83").removeClass("loading") | |||
$(".ui.dropdown.selection.search.width83").removeClass("loading") | |||
$('#choice_model .default.text').text(data[0].JobName) | |||
$('#choice_model input[name="JobId"]').val(data[0].JobID) | |||
loadTrainVersion() | |||
}) | |||
} | |||
function loadTrainVersion(value){ | |||
$.get(`${repolink}/modelmanage/query_train_job_version?JobID=${value}`, (data) => { | |||
let JobID = !value ?$('#choice_model input[name="JobId"]').val(): value | |||
$.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => { | |||
const n_length = data.length | |||
let train_html='' | |||
for (let i=0;i<n_length;i++){ | |||
@@ -221,6 +229,8 @@ | |||
} | |||
$("#job-version").append(train_html) | |||
$(".ui.dropdown.selection.search.width70").removeClass("loading") | |||
$('#choice_version .default.text').text(data[0].VersionName) | |||
$('#choice_version input[name="VersionName"]').val(data[0].VersionName) | |||
}) | |||
} | |||
</script> | |||
@@ -162,6 +162,9 @@ function loadInfo(){ | |||
$.get(`${url}show_model_info_api?name=${ID}`,(data)=>{ | |||
let html = '' | |||
for (let i=0;i<data.length;i++){ | |||
if(!data[i].IsCanOper){ | |||
$("#edit-pencil").css("display","none") | |||
} | |||
html += `<option value="${data[i].Version}">${data[i].Version}</option>` | |||
} | |||
$('#dropdown').append(html) | |||
@@ -218,7 +221,7 @@ function tranSize(value){ | |||
function editorFn(context){ | |||
let id= context.dataset.id | |||
let text = context.dataset.desc | |||
$('#edit-td').replaceWith("<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' rows='3' maxlength='255' style='width:80%;' id='edit-text'></textarea><i class='check icon' style='color: #50d4ab;' onclick='editorSure(\"" + text + "\",\"" + id + "\")'></i><i class='times icon' style='color: #f66f6a;' onclick='editorCancel(\"" + text + "\",\"" + id + "\")'></i></div>"); | |||
$('#edit-td').replaceWith("<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' value='' rows='3' maxlength='255' style='width:80%;' id='edit-text'>"+text+"</textarea><i class='check icon' style='color: #50d4ab;' onclick='editorSure(\"" + text + "\",\"" + id + "\")'></i><i class='times icon' style='color: #f66f6a;' onclick='editorCancel(\"" + text + "\",\"" + id + "\")'></i></div>"); | |||
} | |||
function editorCancel(text,id){ | |||
@@ -247,12 +250,17 @@ function renderInfo(obj,accObj,id){ | |||
$('#edit-pencil').attr("data-desc",obj[key]) | |||
} | |||
else if(key==="Label"){ | |||
let labelArray = obj[key].split(' ') | |||
let html='' | |||
for(let i=0;i<labelArray.length;i++){ | |||
html += `<a class="ui label">${labelArray[i]}</a>` | |||
$('#Label').empty() | |||
if(obj[key]==='--'){ | |||
$('#Label').text(obj[key]) | |||
}else{ | |||
let labelArray = obj[key].trim().split(' ') | |||
let html='' | |||
for(let i=0;i<labelArray.length;i++){ | |||
html += `<a class="ui label">${labelArray[i]}</a>` | |||
} | |||
$('#Label').append(html) | |||
} | |||
$('#Label').append(html) | |||
} | |||
else{ | |||
$(`#${key}`).text(obj[key]) | |||
@@ -1,7 +1,7 @@ | |||
<template> | |||
<div> | |||
<div class="ui container" id="header"> | |||
<el-row style="margin-top:15px;" v-loading.fullscreen.lock="fullscreenLoading"> | |||
<el-row style="margin-top:15px;"> | |||
<el-table | |||
ref="table" | |||
:data="tableData" | |||
@@ -9,7 +9,7 @@ | |||
row-key="ID" | |||
lazy | |||
:load="load" | |||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" | |||
:tree-props="{children: 'Children', hasChildren: 'hasChildren'}" | |||
:header-cell-style="tableHeaderStyle" | |||
> | |||
<el-table-column | |||
@@ -146,7 +146,6 @@ export default { | |||
totalNum:0, | |||
params:{page:0,pageSize:10}, | |||
tableData: [], | |||
fullscreenLoading: false, | |||
url:'', | |||
isLoading:true, | |||
loadNodeMap:new Map(), | |||
@@ -155,7 +154,7 @@ export default { | |||
}, | |||
methods: { | |||
load(tree, treeNode, resolve) { | |||
this.loadNodeMap.set(tree.cName, tree.ID) | |||
this.loadNodeMap.set(tree.cName, {tree,treeNode,resolve}) | |||
this.$axios.get(this.url+'show_model_child_api',{params:{ | |||
name:tree.cName | |||
}}).then((res)=>{ | |||
@@ -246,9 +245,10 @@ export default { | |||
submit(){ | |||
let context = this | |||
let flag= this.check() | |||
console.log(flag,context) | |||
if(flag){ | |||
let data = $("#formId").serialize() | |||
let cName = $("input[name='Name']").val() | |||
let row = {cName:cName} | |||
$("#mask").css({"display":"block","z-index":"9999"}) | |||
$.ajax({ | |||
url:url_href, | |||
@@ -256,6 +256,7 @@ export default { | |||
data:data, | |||
success:function(res){ | |||
context.getModelList() | |||
context.loadrefresh(row) | |||
$('.ui.modal.second').modal('hide') | |||
}, | |||
error: function(xhr){ | |||
@@ -272,9 +273,21 @@ export default { | |||
return false | |||
} | |||
}, | |||
loadrefresh(row){ | |||
if(!this.loadNodeMap.get(row.cName)){ | |||
return | |||
}else{ | |||
let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName) | |||
this.$set( | |||
this.$refs.table.store.states.lazyTreeNodeMap, | |||
tree.ID, | |||
[]) | |||
this.load(tree,treeNode,resolve) | |||
} | |||
}, | |||
deleteModel(id,name){ | |||
let tree={cName:name} | |||
let row={cName:name} | |||
let _this = this | |||
let flag=1 | |||
$('.ui.basic.modal.first') | |||
@@ -288,7 +301,7 @@ export default { | |||
ID:id | |||
}}).then((res)=>{ | |||
_this.getModelList() | |||
_this.loadrefresh(tree) | |||
_this.loadrefresh(row) | |||
}) | |||
flag = true | |||
}, | |||
@@ -302,29 +315,8 @@ export default { | |||
}) | |||
.modal('show') | |||
}, | |||
loadrefresh(tree){ | |||
this.$axios.get(this.url+'show_model_child_api',{params:{ | |||
name:tree.cName | |||
}}).then((res)=>{ | |||
let TrainTaskInfo | |||
let tableData | |||
tableData= res.data | |||
for(let i=0;i<tableData.length;i++){ | |||
TrainTaskInfo = JSON.parse(tableData[i].TrainTaskInfo) | |||
tableData[i].EngineName = TrainTaskInfo.EngineName.split('-')[0] | |||
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource | |||
tableData[i].cName=tableData[i].Name | |||
tableData[i].Name='' | |||
tableData[i].VersionCount = '' | |||
tableData[i].Children = true | |||
} | |||
let id = this.loadNodeMap.get(tree.cName) | |||
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, id, tableData) | |||
}) | |||
}, | |||
getModelList(){ | |||
this.fullscreenLoading = false | |||
this.$axios.get(location.href+'_api',{ | |||
params:this.params | |||
}).then((res)=>{ | |||
@@ -340,7 +332,6 @@ export default { | |||
this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true | |||
} | |||
this.totalNum = res.data.count | |||
this.fullscreenLoading = false | |||
}) | |||
}, | |||
@@ -4130,4 +4130,7 @@ function initDropDown() { | |||
$('.question.circle.icon').hover(function(){ | |||
$(this).popup('show') | |||
$('.ui.popup.mini.top.center').css({"border-color":'rgba(50, 145, 248, 100)',"color":"rgba(3, 102, 214, 100)","border-radius":"5px","border-shadow":"none"}) | |||
}); | |||
}); | |||
//云脑详情页面跳转回上一个页面 | |||
$(".section.backTodeBug").attr("href",localStorage.getItem('all')) |
@@ -549,8 +549,8 @@ display: block; | |||
cursor: pointer; | |||
pointer-events: none; | |||
} | |||
.letf2{ | |||
margin-left: -2px; | |||
.left2{ | |||
margin-left: -2px !important; | |||
} | |||
.width70{ | |||
width: 70% !important; | |||
@@ -578,3 +578,10 @@ display: block; | |||
.mglf{ | |||
margin-left:0.5em !important; | |||
} | |||
.tooltips{ | |||
display: inline-block; | |||
margin-left: 5.5rem; | |||
font-size: 12px; | |||
margin-top: 0.7rem; | |||
color: #888888; | |||
} |