Browse Source

Merge branch 'V20220718' into zouap

pull/2592/head
zouap 2 years ago
parent
commit
152ecf88c6
21 changed files with 117 additions and 199 deletions
  1. +1
    -1
      models/cloudbrain.go
  2. +31
    -0
      routers/repo/cloudbrain.go
  3. +2
    -3
      templates/custom/wait_count.tmpl
  4. +9
    -9
      templates/custom/wait_count_train.tmpl
  5. +2
    -2
      templates/repo/cloudbrain/benchmark/new.tmpl
  6. +1
    -6
      templates/repo/cloudbrain/benchmark/show.tmpl
  7. +1
    -1
      templates/repo/cloudbrain/inference/new.tmpl
  8. +3
    -3
      templates/repo/cloudbrain/inference/show.tmpl
  9. +2
    -38
      templates/repo/cloudbrain/show.tmpl
  10. +1
    -1
      templates/repo/cloudbrain/trainjob/new.tmpl
  11. +7
    -2
      templates/repo/cloudbrain/trainjob/show.tmpl
  12. +2
    -2
      templates/repo/debugjob/index.tmpl
  13. +1
    -1
      templates/repo/grampus/trainjob/gpu/new.tmpl
  14. +1
    -1
      templates/repo/grampus/trainjob/npu/new.tmpl
  15. +6
    -68
      templates/repo/grampus/trainjob/show.tmpl
  16. +1
    -1
      templates/repo/modelarts/inferencejob/new.tmpl
  17. +3
    -3
      templates/repo/modelarts/inferencejob/show.tmpl
  18. +2
    -8
      templates/repo/modelarts/notebook/show.tmpl
  19. +1
    -1
      templates/repo/modelarts/trainjob/new.tmpl
  20. +12
    -46
      templates/repo/modelarts/trainjob/show.tmpl
  21. +28
    -2
      web_src/js/features/cloudrbanin.js

+ 1
- 1
models/cloudbrain.go View File

@@ -1803,7 +1803,7 @@ func GetBenchmarkCountByUserID(userID int64) (int, error) {
func GetWaitingCloudbrainCount(cloudbrainType int, computeResource string, jobTypes ...JobType) (int64, error) { func GetWaitingCloudbrainCount(cloudbrainType int, computeResource string, jobTypes ...JobType) (int64, error) {
sess := x.Where("status=? and type=?", JobWaiting, cloudbrainType) sess := x.Where("status=? and type=?", JobWaiting, cloudbrainType)
if len(jobTypes) > 0 { if len(jobTypes) > 0 {
sess.In("JobType", jobTypes)
sess.In("job_type", jobTypes)
} }
if computeResource != "" { if computeResource != "" {
sess.And("compute_resource=?", computeResource) sess.And("compute_resource=?", computeResource)


+ 31
- 0
routers/repo/cloudbrain.go View File

@@ -264,6 +264,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
} }


if !jobNamePattern.MatchString(displayJobName) { if !jobNamePattern.MatchString(displayJobName) {
cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tpl, &form) ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tpl, &form)
return return
} }
@@ -661,14 +662,35 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
if cloudbrain.TrainResourceSpecs == nil { if cloudbrain.TrainResourceSpecs == nil {
json.Unmarshal([]byte(setting.TrainResourceSpecs), &cloudbrain.TrainResourceSpecs) json.Unmarshal([]byte(setting.TrainResourceSpecs), &cloudbrain.TrainResourceSpecs)
} }
hasSpec := false
for _, tmp := range cloudbrain.TrainResourceSpecs.ResourceSpec { for _, tmp := range cloudbrain.TrainResourceSpecs.ResourceSpec {
if tmp.Id == task.ResourceSpecId { if tmp.Id == task.ResourceSpecId {
hasSpec = true
ctx.Data["GpuNum"] = tmp.GpuNum ctx.Data["GpuNum"] = tmp.GpuNum
ctx.Data["CpuNum"] = tmp.CpuNum ctx.Data["CpuNum"] = tmp.CpuNum
ctx.Data["MemMiB"] = tmp.MemMiB ctx.Data["MemMiB"] = tmp.MemMiB
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB
} }
} }

if !hasSpec && cloudbrain.SpecialPools != nil {
for _, specialPool := range cloudbrain.SpecialPools.Pools {

if specialPool.ResourceSpec != nil {

for _, spec := range specialPool.ResourceSpec {
if task.ResourceSpecId == spec.Id {
ctx.Data["GpuNum"] = spec.GpuNum
ctx.Data["CpuNum"] = spec.CpuNum
ctx.Data["MemMiB"] = spec.MemMiB
ctx.Data["ShareMemMiB"] = spec.ShareMemMiB
break
}
}
}
}
}

} else if task.JobType == string(models.JobTypeInference) { } else if task.JobType == string(models.JobTypeInference) {
if cloudbrain.InferenceResourceSpecs == nil { if cloudbrain.InferenceResourceSpecs == nil {
json.Unmarshal([]byte(setting.InferenceResourceSpecs), &cloudbrain.InferenceResourceSpecs) json.Unmarshal([]byte(setting.InferenceResourceSpecs), &cloudbrain.InferenceResourceSpecs)
@@ -709,6 +731,15 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
ctx.Data["resource_type"] = resourceType.Value ctx.Data["resource_type"] = resourceType.Value
} }
} }
for _, specialPool := range cloudbrain.SpecialPools.Pools {

for _, resourceType := range specialPool.Pool {
if resourceType.Queue == jobRes.Config.GpuType {
ctx.Data["resource_type"] = resourceType.Value
}
}
}

} else if task.JobType == string(models.JobTypeInference) { } else if task.JobType == string(models.JobTypeInference) {
if inferenceGpuInfos == nil { if inferenceGpuInfos == nil {
json.Unmarshal([]byte(setting.InferenceGpuTypes), &inferenceGpuInfos) json.Unmarshal([]byte(setting.InferenceGpuTypes), &inferenceGpuInfos)


+ 2
- 3
templates/custom/wait_count.tmpl View File

@@ -3,13 +3,12 @@
{{$gpuQueue := 0}} {{$gpuQueue := 0}}
{{range $k,$v :=.gpu_types}} {{range $k,$v :=.gpu_types}}
{{if eq $k 0}} {{if eq $k 0}}
{{ $queue := $v.Queue }}
{{ $queue = $v.Queue }}
{{ end }} {{ end }}
{{ end }} {{ end }}

{{ range $k,$v :=.QueuesDetail }} {{ range $k,$v :=.QueuesDetail }}
{{if eq $k $queue}} {{if eq $k $queue}}
{{$gpuQueue :=$v}}
{{$gpuQueue =$v}}
{{ end }} {{ end }}
{{ end }} {{ end }}
<i <i


+ 9
- 9
templates/custom/wait_count_train.tmpl View File

@@ -1,28 +1,28 @@
<div class="tooltip-wati-count" style="margin-left: 155px"> <div class="tooltip-wati-count" style="margin-left: 155px">
{{$queue := ""}} {{$queue := ""}}
{{$gpuQueue := 0}} {{$gpuQueue := 0}}
{{range $k,$v :=.gpu_types}}
{{range $k,$v :=.type}}
{{if eq $k 0}} {{if eq $k 0}}
{{ $queue := $v.Queue }}
{{ $queue = $v.Queue }}
{{ end }} {{ end }}
{{ end }} {{ end }}


{{ range $k,$v :=.QueuesDetail }}
{{ range $k,$v :=.ctx.QueuesDetail }}
{{if eq $k $queue}} {{if eq $k $queue}}
{{$gpuQueue :=$v}}
{{$gpuQueue =$v}}
{{ end }} {{ end }}
{{ end }} {{ end }}
<i <i
class="ri-error-warning-line" class="ri-error-warning-line"
style="margin-right: 0.5rem; font-size: 16px" style="margin-right: 0.5rem; font-size: 16px"
></i> ></i>
<span
>{{.i18n.Tr "repo.wait_count_start"}}
{{if .QueuesDetail}}
<span id="gpu-nums"
>{{.ctx.i18n.Tr "repo.wait_count_start"}}
{{if .type}}
{{ $gpuQueue }} {{ $gpuQueue }}
{{else}} {{else}}
{{.WaitCount}}
{{.ctx.WaitCount}}
{{ end }} {{ end }}
{{.i18n.Tr "repo.wait_count_end"}}</span
{{.ctx.i18n.Tr "repo.wait_count_end"}}</span
> >
</div> </div>

+ 2
- 2
templates/repo/cloudbrain/benchmark/new.tmpl View File

@@ -62,7 +62,7 @@
<a class="active item model_benchmark" <a class="active item model_benchmark"
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $ "type" .benchmark_gpu_types}}
</div> </div>
<div> <div>
<div class="required min_title inline field"> <div class="required min_title inline field">
@@ -157,7 +157,7 @@
<a class="item model_benchmark" <a class="item model_benchmark"
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $ "type" .benchmark_gpu_types}}
</div> </div>


<div> <div>


+ 1
- 6
templates/repo/cloudbrain/benchmark/show.tmpl View File

@@ -232,12 +232,7 @@
<span> <span>
<div class="ac-display-inblock title_text acc-margin-bottom"> <div class="ac-display-inblock title_text acc-margin-bottom">
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
{{if not (eq .StartTime 0)}}
<td>{{TimeSinceUnix1 .StartTime}}</td>
{{else}}
<td>{{TimeSinceUnix1 .CreatedUnix}}
<td>
{{end}}
<td>{{TimeSinceUnix1 .CreatedUnix}}</td>
</span> </span>


<span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:


+ 1
- 1
templates/repo/cloudbrain/inference/new.tmpl View File

@@ -92,7 +92,7 @@
</svg> </svg>
Ascend NPU</a> Ascend NPU</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $ "type" .inference_gpu_types}}
</div> </div>
<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>


+ 3
- 3
templates/repo/cloudbrain/inference/show.tmpl View File

@@ -317,9 +317,9 @@
<span style="font-size: 12px;" class=""> <span style="font-size: 12px;" class="">
{{if not (eq .StartTime 0)}} {{if not (eq .StartTime 0)}}
{{TimeSinceUnix1 .StartTime}} {{TimeSinceUnix1 .StartTime}}
{{else}}
{{TimeSinceUnix1 .CreatedUnix}}
{{end}}
{{else}}
--
{{end}}
</span> </span>
</div> </div>
</td> </td>


+ 2
- 38
templates/repo/cloudbrain/show.tmpl View File

@@ -240,12 +240,7 @@
<span> <span>
<div class="ac-display-inblock title_text acc-margin-bottom"> <div class="ac-display-inblock title_text acc-margin-bottom">
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
{{if not (eq .StartTime 0)}}
<td>{{TimeSinceUnix1 .StartTime}}</td>
{{else}}
<td>{{TimeSinceUnix1 .CreatedUnix}}
<td>
{{end}}
<td>{{TimeSinceUnix1 .CreatedUnix}}</td>
</span> </span>


<span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
@@ -257,9 +252,7 @@
</span> </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 data-tooltip="刷新" style="cursor: pointer;" data-inverted=""
onclick="refreshStatus({{.VersionName}})"><i
class="redo icon redo-color"></i></span>
</div> </div>
</span> </span>
</span> </span>
@@ -588,33 +581,4 @@
} }
document.getElementById("info_display").innerHTML = html; document.getElementById("info_display").innerHTML = html;
} }
function stopBubbling(e) {
e = window.event || e;
if (e.stopPropagation) {
e.stopPropagation(); //阻止事件 冒泡传播
} else {
e.cancelBubble = true; //ie兼容
}
}

function refreshStatus(version_name) {
$(".ui.accordion.border-according").each((index, job) => {
const jobID = job.dataset.jobid;
const repoPath = job.dataset.repopath;
const versionname = job.dataset.version
$.get(`/api/v1/repos/${repoPath}/cloudbrain/${jobID}?version_name=${versionname}`, (data) => {
// header status and duration
//$(`#${version_name}-duration-span`).text(data.JobDuration)
$(`#${version_name}-status-span span`).text(data.JobStatus)
$(`#${version_name}-status-span i`).attr("class", data.JobStatus)
// detail status and duration
//$('#'+version_name+'-duration').text(data.JobDuration)
$('#' + version_name + '-status').text(data.JobStatus)
parseLog()
}).fail(function (err) {
console.log(err);
});
stopBubbling(arguments.callee.caller.arguments[0])
})
}
</script> </script>

+ 1
- 1
templates/repo/cloudbrain/trainjob/new.tmpl View File

@@ -126,7 +126,7 @@
</svg> </svg>
Ascend NPU</a> Ascend NPU</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $ "type" .train_gpu_types}}
</div> </div>
<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>


+ 7
- 2
templates/repo/cloudbrain/trainjob/show.tmpl View File

@@ -326,8 +326,13 @@


<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">
<span style="font-size: 12px;"
class="">{{TimeSinceUnix1 .CreatedUnix}}</span>
<span style="font-size: 12px;">
{{if not (eq .StartTime 0)}}
{{TimeSinceUnix1 .StartTime}}
{{else}}
--
{{end}}
</span>
</div> </div>
</td> </td>
</tr> </tr>


+ 2
- 2
templates/repo/debugjob/index.tmpl View File

@@ -386,7 +386,7 @@
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if .CanDel}} {{if .CanDel}}
<a id="ai-stop-{{.Cloudbrain.ID}}" <a id="ai-stop-{{.Cloudbrain.ID}}"
class='ui basic ai_stop {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "STOPPING" "CREATING" "STARTING" "SUCCEEDED"}}disabled {{else}}blue {{end}}button'
class='ui basic ai_stop {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "STOPPING" "CREATING" "STARTING" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}}blue {{end}}button'
data-repopath="{{$.RepoLink}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.Cloudbrain.ID}}/stop" data-repopath="{{$.RepoLink}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.Cloudbrain.ID}}/stop"
data-jobid="{{.Cloudbrain.ID}}"> data-jobid="{{.Cloudbrain.ID}}">
{{$.i18n.Tr "repo.stop"}} {{$.i18n.Tr "repo.stop"}}
@@ -405,7 +405,7 @@
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{if .CanDel}} {{if .CanDel}}
<a id="ai-delete-{{.Cloudbrain.ID}}" <a id="ai-delete-{{.Cloudbrain.ID}}"
class='ui basic ai_delete {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "SUCCEEDED"}}blue {{else}}disabled {{end}}button'
class='ui basic ai_delete {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "SUCCEEDED" "CREATE_FAILED"}}blue {{else}}disabled {{end}}button'
style="border-radius: .28571429rem;"> style="border-radius: .28571429rem;">
{{$.i18n.Tr "repo.delete"}} {{$.i18n.Tr "repo.delete"}}
</a> </a>


+ 1
- 1
templates/repo/grampus/trainjob/gpu/new.tmpl View File

@@ -113,7 +113,7 @@
</svg> </svg>
Ascend NPU</a> Ascend NPU</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $}}
</div> </div>
<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>


+ 1
- 1
templates/repo/grampus/trainjob/npu/new.tmpl View File

@@ -108,7 +108,7 @@
</svg> </svg>
Ascend NPU</a> Ascend NPU</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $}}
</div> </div>
<div class="required min_title inline field"> <div class="required min_title inline field">


+ 6
- 68
templates/repo/grampus/trainjob/show.tmpl View File

@@ -236,7 +236,7 @@
</h4> </h4>
{{range $k ,$v := .version_list_task}} {{range $k ,$v := .version_list_task}}
<div class="ui accordion border-according" id="accordion{{.VersionName}}" <div class="ui accordion border-according" id="accordion{{.VersionName}}"
data-repopath="{{$.RepoRelPath}}/modelarts/train-job" data-jobid="{{.JobID}}"
data-repopath="{{$.RepoRelPath}}/grampus/train-job" data-jobid="{{.JobID}}"
data-version="{{.VersionName}}"> data-version="{{.VersionName}}">
<div class="{{if eq $k 0}}active{{end}} title padding0"> <div class="{{if eq $k 0}}active{{end}} title padding0">
<div class="according-panel-heading"> <div class="according-panel-heading">
@@ -251,12 +251,7 @@
<div class="ac-display-inblock title_text acc-margin-bottom"> <div class="ac-display-inblock title_text acc-margin-bottom">


<span class="cti-mgRight-sm">
{{if not (eq .StartTime 0)}}
{{TimeSinceUnix1 .StartTime}}
{{else}}
{{TimeSinceUnix1 .CreatedUnix}}
{{end}}</span>
<span class="cti-mgRight-sm">{{TimeSinceUnix1 .CreatedUnix}}</span>
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
{{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span> {{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span>
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
@@ -270,9 +265,9 @@
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">{{.TrainJobDuration}}</span> id="{{.VersionName}}-duration-span">{{.TrainJobDuration}}</span>
<span data-tooltip="刷新" style="cursor: pointer;" data-inverted=""
onclick="refreshStatus({{.VersionName}})"><i
class="redo icon redo-color"></i></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>
<div style="float: right;"> <div style="float: right;">
@@ -350,7 +345,7 @@
{{if not (eq .StartTime 0)}} {{if not (eq .StartTime 0)}}
{{TimeSinceUnix1 .StartTime}} {{TimeSinceUnix1 .StartTime}}
{{else}} {{else}}
{{TimeSinceUnix1 .CreatedUnix}}
--
{{end}}</span> {{end}}</span>
</div> </div>
</td> </td>
@@ -871,64 +866,7 @@
size = size.toFixed(0);//保留的小数位数 size = size.toFixed(0);//保留的小数位数
return size + unitArr[index]; return size + unitArr[index];
} }
function refreshStatus(version_name) {
$.get(`/api/v1/repos/${userName}/${repoPath}/grampus/train-job/${jobID}?version_name=${version_name}`, (data) => {
// header status and duration
$(`#${version_name}-duration-span`).text(data.JobDuration)
$(`#${version_name}-status-span span`).text(data.JobStatus)
$(`#${version_name}-status-span i`).attr("class", data.JobStatus)
// detail status and duration
$('#' + version_name + '-duration').text(data.JobDuration)
$('#' + version_name + '-status').text(data.JobStatus)
$('#' + version_name + '-ai_center').text(data.AiCenter)
loadLog(version_name)



}).fail(function (err) {
console.log(err);
});
stopBubbling(arguments.callee.caller.arguments[0])
}
function deleteVersion(version_name) {
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) => {
if (data.VersionListCount === 0) {
location.href = `/${userName}/${repoPath}/modelarts/train-job`
} else {
$('#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) {
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) { function loadLog(version_name) {
document.getElementById("mask").style.display = "block" 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) => { $.get(`/api/v1/repos/${userName}/${repoPath}/grampus/train-job/${jobID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => {


+ 1
- 1
templates/repo/modelarts/inferencejob/new.tmpl View File

@@ -90,7 +90,7 @@
</svg> </svg>
Ascend NPU</a> Ascend NPU</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $}}
</div> </div>
<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>


+ 3
- 3
templates/repo/modelarts/inferencejob/show.tmpl View File

@@ -266,9 +266,9 @@ td, th {
<span style="font-size: 12px;" class=""> <span style="font-size: 12px;" class="">
{{if not (eq .StartTime 0)}} {{if not (eq .StartTime 0)}}
{{TimeSinceUnix1 .StartTime}} {{TimeSinceUnix1 .StartTime}}
{{else}}
{{TimeSinceUnix1 .CreatedUnix}}
{{end}}
{{else}}
--
{{end}}
</span> </span>
</div> </div>
</td> </td>


+ 2
- 8
templates/repo/modelarts/notebook/show.tmpl View File

@@ -246,14 +246,8 @@
<span> <span>
<div class="ac-display-inblock title_text acc-margin-bottom"> <div class="ac-display-inblock title_text acc-margin-bottom">
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
{{if not (eq .StartTime 0)}}
<td>{{TimeSinceUnix1 .StartTime}}</td>
{{else}}
<td>{{TimeSinceUnix1 .CreatedUnix}}
<td>
{{end}}
{{TimeSinceUnix1 .CreatedUnix}}
</span> </span>

<span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
<span id="{{.VersionName}}-status-span"><i id="icon" <span id="{{.VersionName}}-status-span"><i id="icon"
style="vertical-align: middle;" class="{{.Status}}"></i><span id="text" style="vertical-align: middle;" class="{{.Status}}"></i><span id="text"
@@ -413,7 +407,7 @@
</div> </div>
</td> </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.dura_time"}} {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
</td> </td>


+ 1
- 1
templates/repo/modelarts/trainjob/new.tmpl View File

@@ -118,7 +118,7 @@
</svg> </svg>
Ascend NPU</a> Ascend NPU</a>
</div> </div>
{{template "custom/wait_count_train" .}}
{{template "custom/wait_count_train" Dict "ctx" $}}
</div> </div>
<div class="required inline min_title field"> <div class="required inline min_title field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>


+ 12
- 46
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -270,12 +270,14 @@
{{end}} {{end}}


{{if .CanDel}} {{if .CanDel}}
<a class="ti-action-menu-item {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}"
<a class="ti-action-menu-item stop-show-version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}"
id="{{.VersionName}}-stop" id="{{.VersionName}}-stop"
onclick="stopVersion({{.VersionName}})">{{$.i18n.Tr "repo.stop"}}</a>
data-jobid="{{.JobID}}"
data-repopath="{{$.RepoRelPath}}/modelarts/train-job"
data-version = "{{.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">{{$.i18n.Tr "repo.stop"}}</a>
{{end}} {{end}}




@@ -290,11 +292,8 @@
<div class="ac-display-inblock title_text acc-margin-bottom"> <div class="ac-display-inblock title_text acc-margin-bottom">


<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
{{if not (eq .Cloudbrain.StartTime 0)}}
{{TimeSinceUnix1 .Cloudbrain.StartTime}}
{{else}}
{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}} {{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}
{{end}}</span>
</span>
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
{{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span> {{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span>
<span class="cti-mgRight-sm"> <span class="cti-mgRight-sm">
@@ -308,10 +307,9 @@
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">{{.TrainJobDuration}}</span> id="{{.VersionName}}-duration-span">{{.TrainJobDuration}}</span>
<span data-tooltip="刷新" style="cursor: pointer;" data-inverted=""
onclick="refreshStatus({{.VersionName}})"><i
class="redo icon redo-color"></i></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>
</span> </span>
@@ -379,7 +377,7 @@
{{if not (eq .Cloudbrain.StartTime 0)}} {{if not (eq .Cloudbrain.StartTime 0)}}
{{TimeSinceUnix1 .Cloudbrain.StartTime}} {{TimeSinceUnix1 .Cloudbrain.StartTime}}
{{else}} {{else}}
{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}
--
{{end}}</span> {{end}}</span>
</div> </div>
</td> </td>
@@ -877,28 +875,6 @@
$('#name').val(modelName) $('#name').val(modelName)
$('#version').val("0.0.1") $('#version').val("0.0.1")
} }
function refreshStatus(version_name) {
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`, (data) => {
// header status and duration
$(`#${version_name}-duration-span`).text(data.JobDuration)
$(`#${version_name}-status-span span`).text(data.JobStatus)
$(`#${version_name}-status-span i`).attr("class", data.JobStatus)
// detail status and duration
$('#' + version_name + '-duration').text(data.JobDuration)
$('#' + version_name + '-status').text(data.JobStatus)
console.log(data)
if (["KILLED", "FAILED", "START_FAILED", "STOPPED", "COMPLETED"].includes(data.JobStatus)) {
$('#' + version_name + '-stop').addClass('disabled')
}

loadLog(version_name)


}).fail(function (err) {
console.log(err);
});
stopBubbling(arguments.callee.caller.arguments[0])
}
function deleteVersion(version_name) { function deleteVersion(version_name) {
stopBubbling(arguments.callee.caller.arguments[0]) stopBubbling(arguments.callee.caller.arguments[0])
let flag = 1; let flag = 1;
@@ -928,17 +904,7 @@
.modal('show') .modal('show')


} }
function stopVersion(version_name) {
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) { function loadLog(version_name) {
$.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { $.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=end_line]').val(data.EndLine)


+ 28
- 2
web_src/js/features/cloudrbanin.js View File

@@ -123,6 +123,7 @@ export default async function initCloudrain() {
"KILLED", "KILLED",
"COMPLETED", "COMPLETED",
"SUCCEEDED", "SUCCEEDED",
"CREATE_FAILED",
].includes(status) ].includes(status)
) { ) {
$("#ai-delete-" + ID) $("#ai-delete-" + ID)
@@ -166,6 +167,7 @@ export default async function initCloudrain() {
"START_FAILED", "START_FAILED",
"SUCCEEDED", "SUCCEEDED",
"STOPPED", "STOPPED",
"CREATE_FAILED",
].includes(status) ].includes(status)
) { ) {
return; return;
@@ -177,6 +179,7 @@ export default async function initCloudrain() {
"KILLING", "KILLING",
"COMPLETED", "COMPLETED",
"SUCCEEDED", "SUCCEEDED",
"CREATE_FAILED",
"STOPPED", "STOPPED",
]; ];
$.get( $.get(
@@ -327,6 +330,23 @@ export default async function initCloudrain() {
}); });
} }


$(".stop-show-version").click(function (e) {
const ID = this.dataset.jobid;
const repoPath = this.dataset.repopath;
const version_name = this.dataset.version;
const url = `/api/v1/repos/${repoPath}/${ID}/stop_version`;
$.post(url, { version_name: version_name }, (data) => {
if (data.StatusOK === 0) {
$(`#${version_name}-stop`).removeClass("blue");
$(`#${version_name}-stop`).addClass("disabled");
refreshStatusShow(version_name, ID, repoPath);
}
}).fail(function (err) {
console.log(err);
});
e.stopPropagation();
});

$("#refresh-status").click(function (e) { $("#refresh-status").click(function (e) {
let version_name = $(this).data("version"); let version_name = $(this).data("version");
let ID = $(`#accordion${version_name}`).data("jobid"); let ID = $(`#accordion${version_name}`).data("jobid");
@@ -339,11 +359,16 @@ export default async function initCloudrain() {
$.get( $.get(
`/api/v1/repos/${repoPath}/${ID}?version_name=${version_name}`, `/api/v1/repos/${repoPath}/${ID}?version_name=${version_name}`,
(data) => { (data) => {
//accroding下的状态
$(`#${version_name}-status-span span`).text(data.JobStatus); $(`#${version_name}-status-span span`).text(data.JobStatus);
//accroding下的状态图标
$(`#${version_name}-status-span i`).attr("class", data.JobStatus); $(`#${version_name}-status-span i`).attr("class", data.JobStatus);
//accroding下的运行时长
$(`#${version_name}-duration-span`).text(data.JobDuration); $(`#${version_name}-duration-span`).text(data.JobDuration);
$("#" + versionname + "-duration").text(data.JobDuration);
$("#" + versionname + "-status").text(data.JobStatus);
//配置信息详情页的状态
$(`#${version_name}-status`).text(data.JobStatus);
//配置信息详情页的状态
$(`#${version_name}-duration`).text(data.JobDuration);
} }
).fail(function (err) { ).fail(function (err) {
console.log(err); console.log(err);
@@ -363,6 +388,7 @@ export default async function initCloudrain() {
"KILLED", "KILLED",
"COMPLETED", "COMPLETED",
"SUCCEEDED", "SUCCEEDED",
"CREATE_FAILED",
].includes(data.JobStatus) ].includes(data.JobStatus)
) { ) {
$("#ai-delete-" + ID) $("#ai-delete-" + ID)


Loading…
Cancel
Save