@@ -1803,7 +1803,7 @@ func GetBenchmarkCountByUserID(userID int64) (int, error) { | |||
func GetWaitingCloudbrainCount(cloudbrainType int, computeResource string, jobTypes ...JobType) (int64, error) { | |||
sess := x.Where("status=? and type=?", JobWaiting, cloudbrainType) | |||
if len(jobTypes) > 0 { | |||
sess.In("JobType", jobTypes) | |||
sess.In("job_type", jobTypes) | |||
} | |||
if computeResource != "" { | |||
sess.And("compute_resource=?", computeResource) | |||
@@ -264,6 +264,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
} | |||
if !jobNamePattern.MatchString(displayJobName) { | |||
cloudBrainNewDataPrepare(ctx) | |||
ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tpl, &form) | |||
return | |||
} | |||
@@ -661,14 +662,35 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||
if cloudbrain.TrainResourceSpecs == nil { | |||
json.Unmarshal([]byte(setting.TrainResourceSpecs), &cloudbrain.TrainResourceSpecs) | |||
} | |||
hasSpec := false | |||
for _, tmp := range cloudbrain.TrainResourceSpecs.ResourceSpec { | |||
if tmp.Id == task.ResourceSpecId { | |||
hasSpec = true | |||
ctx.Data["GpuNum"] = tmp.GpuNum | |||
ctx.Data["CpuNum"] = tmp.CpuNum | |||
ctx.Data["MemMiB"] = tmp.MemMiB | |||
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) { | |||
if cloudbrain.InferenceResourceSpecs == nil { | |||
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 | |||
} | |||
} | |||
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) { | |||
if inferenceGpuInfos == nil { | |||
json.Unmarshal([]byte(setting.InferenceGpuTypes), &inferenceGpuInfos) | |||
@@ -3,13 +3,12 @@ | |||
{{$gpuQueue := 0}} | |||
{{range $k,$v :=.gpu_types}} | |||
{{if eq $k 0}} | |||
{{ $queue := $v.Queue }} | |||
{{ $queue = $v.Queue }} | |||
{{ end }} | |||
{{ end }} | |||
{{ range $k,$v :=.QueuesDetail }} | |||
{{if eq $k $queue}} | |||
{{$gpuQueue :=$v}} | |||
{{$gpuQueue =$v}} | |||
{{ end }} | |||
{{ end }} | |||
<i | |||
@@ -1,28 +1,28 @@ | |||
<div class="tooltip-wati-count" style="margin-left: 155px"> | |||
{{$queue := ""}} | |||
{{$gpuQueue := 0}} | |||
{{range $k,$v :=.gpu_types}} | |||
{{range $k,$v :=.type}} | |||
{{if eq $k 0}} | |||
{{ $queue := $v.Queue }} | |||
{{ $queue = $v.Queue }} | |||
{{ end }} | |||
{{ end }} | |||
{{ range $k,$v :=.QueuesDetail }} | |||
{{ range $k,$v :=.ctx.QueuesDetail }} | |||
{{if eq $k $queue}} | |||
{{$gpuQueue :=$v}} | |||
{{$gpuQueue =$v}} | |||
{{ end }} | |||
{{ end }} | |||
<i | |||
class="ri-error-warning-line" | |||
style="margin-right: 0.5rem; font-size: 16px" | |||
></i> | |||
<span | |||
>{{.i18n.Tr "repo.wait_count_start"}} | |||
{{if .QueuesDetail}} | |||
<span id="gpu-nums" | |||
>{{.ctx.i18n.Tr "repo.wait_count_start"}} | |||
{{if .type}} | |||
{{ $gpuQueue }} | |||
{{else}} | |||
{{.WaitCount}} | |||
{{.ctx.WaitCount}} | |||
{{ end }} | |||
{{.i18n.Tr "repo.wait_count_end"}}</span | |||
{{.ctx.i18n.Tr "repo.wait_count_end"}}</span | |||
> | |||
</div> |
@@ -62,7 +62,7 @@ | |||
<a class="active item model_benchmark" | |||
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $ "type" .benchmark_gpu_types}} | |||
</div> | |||
<div> | |||
<div class="required min_title inline field"> | |||
@@ -157,7 +157,7 @@ | |||
<a class="item model_benchmark" | |||
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $ "type" .benchmark_gpu_types}} | |||
</div> | |||
<div> | |||
@@ -232,12 +232,7 @@ | |||
<span> | |||
<div class="ac-display-inblock title_text acc-margin-bottom"> | |||
<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 class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: | |||
@@ -92,7 +92,7 @@ | |||
</svg> | |||
Ascend NPU</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $ "type" .inference_gpu_types}} | |||
</div> | |||
<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> | |||
@@ -317,9 +317,9 @@ | |||
<span style="font-size: 12px;" class=""> | |||
{{if not (eq .StartTime 0)}} | |||
{{TimeSinceUnix1 .StartTime}} | |||
{{else}} | |||
{{TimeSinceUnix1 .CreatedUnix}} | |||
{{end}} | |||
{{else}} | |||
-- | |||
{{end}} | |||
</span> | |||
</div> | |||
</td> | |||
@@ -240,12 +240,7 @@ | |||
<span> | |||
<div class="ac-display-inblock title_text acc-margin-bottom"> | |||
<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 class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: | |||
@@ -257,9 +252,7 @@ | |||
</span> | |||
<span class="cti-mgRight-sm uc-accordionTitle-black" | |||
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> | |||
</span> | |||
</span> | |||
@@ -588,33 +581,4 @@ | |||
} | |||
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> |
@@ -126,7 +126,7 @@ | |||
</svg> | |||
Ascend NPU</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $ "type" .train_gpu_types}} | |||
</div> | |||
<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> | |||
@@ -326,8 +326,13 @@ | |||
<td class="ti-text-form-content"> | |||
<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> | |||
</td> | |||
</tr> | |||
@@ -386,7 +386,7 @@ | |||
{{$.CsrfTokenHtml}} | |||
{{if .CanDel}} | |||
<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-jobid="{{.Cloudbrain.ID}}"> | |||
{{$.i18n.Tr "repo.stop"}} | |||
@@ -405,7 +405,7 @@ | |||
{{$.CsrfTokenHtml}} | |||
{{if .CanDel}} | |||
<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;"> | |||
{{$.i18n.Tr "repo.delete"}} | |||
</a> | |||
@@ -113,7 +113,7 @@ | |||
</svg> | |||
Ascend NPU</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $}} | |||
</div> | |||
<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> | |||
@@ -108,7 +108,7 @@ | |||
</svg> | |||
Ascend NPU</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $}} | |||
</div> | |||
<div class="required min_title inline field"> | |||
@@ -236,7 +236,7 @@ | |||
</h4> | |||
{{range $k ,$v := .version_list_task}} | |||
<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}}"> | |||
<div class="{{if eq $k 0}}active{{end}} title padding0"> | |||
<div class="according-panel-heading"> | |||
@@ -251,12 +251,7 @@ | |||
<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"> | |||
{{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span> | |||
<span class="cti-mgRight-sm"> | |||
@@ -270,9 +265,9 @@ | |||
class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span> | |||
<span class="cti-mgRight-sm uc-accordionTitle-black" | |||
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 style="float: right;"> | |||
@@ -350,7 +345,7 @@ | |||
{{if not (eq .StartTime 0)}} | |||
{{TimeSinceUnix1 .StartTime}} | |||
{{else}} | |||
{{TimeSinceUnix1 .CreatedUnix}} | |||
-- | |||
{{end}}</span> | |||
</div> | |||
</td> | |||
@@ -871,64 +866,7 @@ | |||
size = size.toFixed(0);//保留的小数位数 | |||
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) { | |||
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) => { | |||
@@ -90,7 +90,7 @@ | |||
</svg> | |||
Ascend NPU</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $}} | |||
</div> | |||
<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> | |||
@@ -266,9 +266,9 @@ td, th { | |||
<span style="font-size: 12px;" class=""> | |||
{{if not (eq .StartTime 0)}} | |||
{{TimeSinceUnix1 .StartTime}} | |||
{{else}} | |||
{{TimeSinceUnix1 .CreatedUnix}} | |||
{{end}} | |||
{{else}} | |||
-- | |||
{{end}} | |||
</span> | |||
</div> | |||
</td> | |||
@@ -246,14 +246,8 @@ | |||
<span> | |||
<div class="ac-display-inblock title_text acc-margin-bottom"> | |||
<span class="cti-mgRight-sm"> | |||
{{if not (eq .StartTime 0)}} | |||
<td>{{TimeSinceUnix1 .StartTime}}</td> | |||
{{else}} | |||
<td>{{TimeSinceUnix1 .CreatedUnix}} | |||
<td> | |||
{{end}} | |||
{{TimeSinceUnix1 .CreatedUnix}} | |||
</span> | |||
<span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: | |||
<span id="{{.VersionName}}-status-span"><i id="icon" | |||
style="vertical-align: middle;" class="{{.Status}}"></i><span id="text" | |||
@@ -413,7 +407,7 @@ | |||
</div> | |||
</td> | |||
</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"> | |||
{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} | |||
</td> | |||
@@ -118,7 +118,7 @@ | |||
</svg> | |||
Ascend NPU</a> | |||
</div> | |||
{{template "custom/wait_count_train" .}} | |||
{{template "custom/wait_count_train" Dict "ctx" $}} | |||
</div> | |||
<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> | |||
@@ -270,12 +270,14 @@ | |||
{{end}} | |||
{{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" | |||
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}} | |||
<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}} | |||
@@ -290,11 +292,8 @@ | |||
<div class="ac-display-inblock title_text acc-margin-bottom"> | |||
<span class="cti-mgRight-sm"> | |||
{{if not (eq .Cloudbrain.StartTime 0)}} | |||
{{TimeSinceUnix1 .Cloudbrain.StartTime}} | |||
{{else}} | |||
{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}} | |||
{{end}}</span> | |||
</span> | |||
<span class="cti-mgRight-sm"> | |||
{{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span> | |||
<span class="cti-mgRight-sm"> | |||
@@ -308,10 +307,9 @@ | |||
class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span> | |||
<span class="cti-mgRight-sm uc-accordionTitle-black" | |||
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> | |||
</span> | |||
</span> | |||
@@ -379,7 +377,7 @@ | |||
{{if not (eq .Cloudbrain.StartTime 0)}} | |||
{{TimeSinceUnix1 .Cloudbrain.StartTime}} | |||
{{else}} | |||
{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}} | |||
-- | |||
{{end}}</span> | |||
</div> | |||
</td> | |||
@@ -877,28 +875,6 @@ | |||
$('#name').val(modelName) | |||
$('#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) { | |||
stopBubbling(arguments.callee.caller.arguments[0]) | |||
let flag = 1; | |||
@@ -928,17 +904,7 @@ | |||
.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) { | |||
$.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) | |||
@@ -123,6 +123,7 @@ export default async function initCloudrain() { | |||
"KILLED", | |||
"COMPLETED", | |||
"SUCCEEDED", | |||
"CREATE_FAILED", | |||
].includes(status) | |||
) { | |||
$("#ai-delete-" + ID) | |||
@@ -166,6 +167,7 @@ export default async function initCloudrain() { | |||
"START_FAILED", | |||
"SUCCEEDED", | |||
"STOPPED", | |||
"CREATE_FAILED", | |||
].includes(status) | |||
) { | |||
return; | |||
@@ -177,6 +179,7 @@ export default async function initCloudrain() { | |||
"KILLING", | |||
"COMPLETED", | |||
"SUCCEEDED", | |||
"CREATE_FAILED", | |||
"STOPPED", | |||
]; | |||
$.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) { | |||
let version_name = $(this).data("version"); | |||
let ID = $(`#accordion${version_name}`).data("jobid"); | |||
@@ -339,11 +359,16 @@ export default async function initCloudrain() { | |||
$.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); | |||
$("#" + 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) { | |||
console.log(err); | |||
@@ -363,6 +388,7 @@ export default async function initCloudrain() { | |||
"KILLED", | |||
"COMPLETED", | |||
"SUCCEEDED", | |||
"CREATE_FAILED", | |||
].includes(data.JobStatus) | |||
) { | |||
$("#ai-delete-" + ID) | |||