Browse Source

Merge pull request '修复云脑2训练任务的权限问题' (#1118) from zhou into V20211213

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1118
Reviewed-by: lewis <747342561@qq.com>
pull/1123/head
lewis 3 years ago
parent
commit
18e3493c5a
3 changed files with 22 additions and 46 deletions
  1. +6
    -6
      templates/repo/modelarts/trainjob/index.tmpl
  2. +14
    -39
      templates/repo/modelarts/trainjob/show.tmpl
  3. +2
    -1
      templates/repo/modelmanage/showinfo.tmpl

+ 6
- 6
templates/repo/modelarts/trainjob/index.tmpl View File

@@ -137,10 +137,10 @@
</div> </div>


<div class="three wide column text center padding0"> <div class="three wide column text center padding0">
<!-- 删除任务 -->
<!-- 停止任务 -->
<div class="ui compact buttons"> <div class="ui compact buttons">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if $.Permission.CanWrite $.UnitTypeCloudBrain}}
{{if .CanDel}}
<a style="padding: 0.5rem 1rem;" id="{{.VersionName}}-stop" class="ui basic {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{else}} blue {{end}}button" onclick="stopVersion({{.VersionName}},{{.JobID}})"> <a style="padding: 0.5rem 1rem;" id="{{.VersionName}}-stop" class="ui basic {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{else}} blue {{end}}button" onclick="stopVersion({{.VersionName}},{{.JobID}})">
{{$.i18n.Tr "repo.stop"}} {{$.i18n.Tr "repo.stop"}}
</a> </a>
@@ -151,15 +151,16 @@
{{end}} {{end}}


</div> </div>
<!-- 删除任务 -->
<form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/del" method="post"> <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/del" method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if $.Permission.CanWrite $.UnitTypeCloudBrain}}
{{if .CanDel}}
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="model-delete-{{.JobID}}" class="ui basic blue button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="model-delete-{{.JobID}}" class="ui basic blue button" onclick="assertDelete(this)" style="border-radius: .28571429rem;">
{{$.i18n.Tr "repo.delete"}} {{$.i18n.Tr "repo.delete"}}
</a> </a>
{{else}} {{else}}
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" class="ui basic button disabled" onclick="assertDelete(this)" style="border-radius: .28571429rem;">
{{$.i18n.Tr "repo.delete"}}
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" class="ui basic button disabled" style="border-radius: .28571429rem;">
{{$.i18n.Tr "repo.delete"}}
</a> </a>
{{end}} {{end}}
</form> </form>
@@ -206,7 +207,6 @@
{{template "base/footer" .}} {{template "base/footer" .}}


<script> <script>

console.log({{.Tasks}}) console.log({{.Tasks}})
// 调试和评分新开窗口 // 调试和评分新开窗口
function stop(obj) { function stop(obj) {


+ 14
- 39
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -165,7 +165,6 @@ td, th {
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<h4 class="ui header" id="vertical-segment"> <h4 class="ui header" id="vertical-segment">
<!-- <a href="javascript:window.history.back();"><i class="arrow left icon"></i>返回</a> -->
<div class="ui breadcrumb"> <div class="ui breadcrumb">
<a class="section" href="{{.RepoLink}}/cloudbrain"> <a class="section" href="{{.RepoLink}}/cloudbrain">
{{.i18n.Tr "repo.cloudbrain"}} {{.i18n.Tr "repo.cloudbrain"}}
@@ -187,22 +186,21 @@ td, th {
<span class="accordion-panel-title-content"> <span class="accordion-panel-title-content">
<span> <span>
<div style="float: right;"> <div style="float: right;">
<!-- <a class="ti-action-menu-item {{if ne .Status "COMPLETED"}}disabled {{end}}">创建模型</a> -->
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if $.canNewJob}}
{{if .CanModify}}
<a class="ti-action-menu-item" href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">{{$.i18n.Tr "repo.modelarts.modify"}}</a> <a class="ti-action-menu-item" href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">{{$.i18n.Tr "repo.modelarts.modify"}}</a>
{{else}} {{else}}
<a class="ti-action-menu-item disabled" href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">{{$.i18n.Tr "repo.modelarts.modify"}}</a> <a class="ti-action-menu-item disabled" href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version?version_name={{.VersionName}}">{{$.i18n.Tr "repo.modelarts.modify"}}</a>
{{end}} {{end}}
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if $.Permission.CanWrite $.UnitTypeCloudBrain}}
{{if .CanDel}}
<a class="ti-action-menu-item {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}" id="{{.VersionName}}-stop" onclick="stopVersion({{.VersionName}})">{{$.i18n.Tr "repo.stop"}}</a> <a class="ti-action-menu-item {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}" id="{{.VersionName}}-stop" onclick="stopVersion({{.VersionName}})">{{$.i18n.Tr "repo.stop"}}</a>
{{else}} {{else}}
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-stop" onclick="stopVersion({{.VersionName}})">{{$.i18n.Tr "repo.stop"}}</a> <a class="ti-action-menu-item disabled" id="{{.VersionName}}-stop" onclick="stopVersion({{.VersionName}})">{{$.i18n.Tr "repo.stop"}}</a>
{{end}} {{end}}
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if $.Permission.CanWrite $.UnitTypeCloudBrain}}
{{if .CanDel}}
<a class="ti-action-menu-item" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">{{$.i18n.Tr "repo.delete"}}</a> <a class="ti-action-menu-item" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">{{$.i18n.Tr "repo.delete"}}</a>
{{else}} {{else}}
<a class="ti-action-menu-item disabled" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">{{$.i18n.Tr "repo.delete"}}</a> <a class="ti-action-menu-item disabled" onclick="deleteVersion({{.VersionName}})" style="color: #FF4D4F;">{{$.i18n.Tr "repo.delete"}}</a>
@@ -243,12 +241,11 @@ td, th {
<tbody class="ti-text-form"> <tbody class="ti-text-form">
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_task"}}
{{$.i18n.Tr "repo.cloudbrain_task"}}
</td> </td>

<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w"> <div class="text-span text-span-w">
{{.JobName}}
{{.JobName}}
</div> </div>
</td> </td>
</tr> </tr>
@@ -259,7 +256,7 @@ td, th {


<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-status"> <div class="text-span text-span-w" id="{{.VersionName}}-status">
{{.Status}}
{{.Status}}
</div> </div>
</td> </td>
</tr> </tr>
@@ -270,7 +267,7 @@ td, th {
<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w"> <div class="text-span text-span-w">
{{.VersionName}}
{{.VersionName}}
</div> </div>
</td> </td>
</tr> </tr>
@@ -287,7 +284,7 @@ td, th {
</tr> </tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
</td> </td>
<td class="ti-text-form-content"> <td class="ti-text-form-content">
@@ -309,9 +306,8 @@ td, th {
</tr> </tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}
{{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}
</td> </td>
<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w"> <div class="text-span text-span-w">
{{.WorkServerNumber}} {{.WorkServerNumber}}
@@ -326,9 +322,8 @@ td, th {
<tbody class="ti-text-form"> <tbody class="ti-text-form">
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}
{{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}
</td> </td>
<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w"> <div class="text-span text-span-w">
{{.EngineName}} {{.EngineName}}
@@ -348,12 +343,12 @@ td, th {
</tr> </tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
{{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
</td> </td>
<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w"> <div class="text-span text-span-w">
{{.BootFile}}
{{.BootFile}}
</div> </div>
</td> </td>
</tr> </tr>
@@ -379,17 +374,7 @@ td, th {
</div> </div>
</td> </td>
</tr> </tr>
<!-- <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
训练输出位置
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.TrainUrl}}
</div>
</td>
</tr> -->
</tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.description"}} {{$.i18n.Tr "repo.modelarts.train_job.description"}}
@@ -414,15 +399,7 @@ td, th {
<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 top attached segment" style="background: #f0f0f0;">
<div class="center aligned">
<label>{{$.i18n.Tr "repo.modelarts.log"}}:</label>
</div>
</div> -->
<div class="ui attached log" onscroll="logScroll({{.VersionName}})" id="log{{.VersionName}}" style="height: 300px !important; overflow: auto;"> <div class="ui attached log" onscroll="logScroll({{.VersionName}})" id="log{{.VersionName}}" style="height: 300px !important; overflow: auto;">
<!-- <input type="hidden" class="version_name" name="version_name" value={{.VersionName}}> -->
<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>
@@ -473,8 +450,8 @@ td, th {
{{template "base/footer" .}} {{template "base/footer" .}}


<script> <script>
console.log({{.version_list_task}})
$('.menu .item').tab() $('.menu .item').tab()
// $('.ui.style.accordion').accordion();


$(document).ready(function(){ $(document).ready(function(){
$('.ui.accordion').accordion({selector:{trigger:'.icon'}}); $('.ui.accordion').accordion({selector:{trigger:'.icon'}});
@@ -501,8 +478,6 @@ td, th {
e.cancelBubble = true; //ie兼容 e.cancelBubble = true; //ie兼容
} }
} }
// let timeid = window.setInterval(refreshStatus(version_name), 30000);
// document.ready(refreshStatus(version_name))
let timeid = window.setInterval(loadJobStatus, 30000); let timeid = window.setInterval(loadJobStatus, 30000);
$(document).ready(loadJobStatus); $(document).ready(loadJobStatus);


+ 2
- 1
templates/repo/modelmanage/showinfo.tmpl View File

@@ -254,7 +254,8 @@ function renderInfo(obj,accObj,id){
if(obj[key]==='--'){ if(obj[key]==='--'){
$('#Label').text(obj[key]) $('#Label').text(obj[key])
}else{ }else{
let labelArray = obj[key].trim().split(' ')
let labelArray = obj[key].trim().replace(/ +/g,' ').split(' ')
let html='' let html=''
for(let i=0;i<labelArray.length;i++){ for(let i=0;i<labelArray.length;i++){
html += `<a class="ui label">${labelArray[i]}</a>` html += `<a class="ui label">${labelArray[i]}</a>`


Loading…
Cancel
Save