@@ -179,10 +179,17 @@ func DownloadCloudBrains(ctx *context.Context) { | |||||
func allValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { | func allValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { | ||||
return map[string]string{getCellName("A", row): rs.JobName, getCellName("B", row): rs.Status, getCellName("C", row): rs.JobType, getCellName("D", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("E", row): getDurationTime(rs), | return map[string]string{getCellName("A", row): rs.JobName, getCellName("B", row): rs.Status, getCellName("C", row): rs.JobType, getCellName("D", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("E", row): getDurationTime(rs), | ||||
getCellName("F", row): rs.ComputeResource, getCellName("G", row): rs.Name, getCellName("H", row): rs.Repo.OwnerName + "/" + rs.Repo.Alias, getCellName("I", row): rs.JobName, | |||||
getCellName("F", row): rs.ComputeResource, getCellName("G", row): rs.Name, getCellName("H", row): getRepoPathName(rs), getCellName("I", row): rs.JobName, | |||||
} | } | ||||
} | } | ||||
func getRepoPathName(rs *models.CloudbrainInfo) string { | |||||
if rs.Repo != nil { | |||||
return rs.Repo.OwnerName + "/" + rs.Repo.Alias | |||||
} | |||||
return "" | |||||
} | |||||
func getDurationTime(rs *models.CloudbrainInfo) string { | func getDurationTime(rs *models.CloudbrainInfo) string { | ||||
if rs.JobType == "TRAIN" || rs.JobType == "INFERENCE" { | if rs.JobType == "TRAIN" || rs.JobType == "INFERENCE" { | ||||
return rs.TrainJobDuration | return rs.TrainJobDuration | ||||
@@ -878,9 +878,10 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
}, reqAdmin()) | }, reqAdmin()) | ||||
}, reqAnyRepoReader()) | }, reqAnyRepoReader()) | ||||
m.Group("/cloudbrain", func() { | m.Group("/cloudbrain", func() { | ||||
// m.Get("/:jobid", repo.GetCloudbrainTask) | |||||
m.Get("/:jobname", repo.GetCloudbrainTask) | |||||
m.Get("/:jobname/log", repo.CloudbrainGetLog) | |||||
m.Get("/:jobid", repo.GetCloudbrainTask) | |||||
m.Get("/:jobid/log", repo.CloudbrainGetLog) | |||||
// m.Get("/:jobname", repo.GetCloudbrainTask) | |||||
// m.Get("/:jobname/log", repo.CloudbrainGetLog) | |||||
}, reqRepoReader(models.UnitTypeCloudBrain)) | }, reqRepoReader(models.UnitTypeCloudBrain)) | ||||
m.Group("/modelarts", func() { | m.Group("/modelarts", func() { | ||||
m.Group("/notebook", func() { | m.Group("/notebook", func() { | ||||
@@ -49,8 +49,11 @@ func GetCloudbrainTask(ctx *context.APIContext) { | |||||
err error | err error | ||||
) | ) | ||||
jobName := ctx.Params(":jobname") | |||||
job, err := models.GetCloudbrainByName(jobName) | |||||
// jobName := ctx.Params(":jobname") | |||||
// job, err := models.GetCloudbrainByName(jobName) | |||||
jobID := ctx.Params(":jobid") | |||||
repoID := ctx.Repo.Repository.ID | |||||
job, err := models.GetRepoCloudBrainByJobID(repoID, jobID) | |||||
if err != nil { | if err != nil { | ||||
ctx.Data["error"] = err.Error() | ctx.Data["error"] = err.Error() | ||||
} | } | ||||
@@ -83,6 +86,7 @@ func GetCloudbrainTask(ctx *context.APIContext) { | |||||
} | } | ||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"JobID": result.Config.JobID, | |||||
"JobName": result.Config.JobName, | "JobName": result.Config.JobName, | ||||
"JobStatus": result.JobStatus.State, | "JobStatus": result.JobStatus.State, | ||||
"SubState": result.JobStatus.SubState, | "SubState": result.JobStatus.SubState, | ||||
@@ -93,8 +97,11 @@ func GetCloudbrainTask(ctx *context.APIContext) { | |||||
} | } | ||||
func CloudbrainGetLog(ctx *context.Context) { | func CloudbrainGetLog(ctx *context.Context) { | ||||
jobName := ctx.Params(":jobname") | |||||
job, err := models.GetCloudbrainByName(jobName) | |||||
// jobName := ctx.Params(":jobname") | |||||
// job, err := models.GetCloudbrainByName(jobName) | |||||
jobID := ctx.Params(":jobid") | |||||
repoID := ctx.Repo.Repository.ID | |||||
job, err := models.GetRepoCloudBrainByJobID(repoID, jobID) | |||||
if err != nil { | if err != nil { | ||||
log.Error("GetCloudbrainByJobID failed: %v", err, ctx.Data["MsgID"]) | log.Error("GetCloudbrainByJobID failed: %v", err, ctx.Data["MsgID"]) | ||||
ctx.ServerError(err.Error(), err) | ctx.ServerError(err.Error(), err) | ||||
@@ -141,7 +148,7 @@ func CloudbrainGetLog(ctx *context.Context) { | |||||
} | } | ||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"JobName": jobName, | |||||
"JobID": jobID, | |||||
"Content": content, | "Content": content, | ||||
}) | }) | ||||
@@ -27,34 +27,34 @@ | |||||
<!-- 表头 --> | <!-- 表头 --> | ||||
<div class="ui grid stackable" style="background: #f0f0f0;;"> | <div class="ui grid stackable" style="background: #f0f0f0;;"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="two wide column padding0"> | |||||
<div class="two wide column nowrap"> | |||||
<span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | ||||
</div> | </div> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | ||||
</div> | </div> | ||||
<div class="two wide column text center padding0" style="width: 10% !important;"> | |||||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||||
<span>{{$.i18n.Tr "repo.modelarts.status"}}</span> | <span>{{$.i18n.Tr "repo.modelarts.status"}}</span> | ||||
</div> | </div> | ||||
<div class="two wide column text center padding0" style="width: 10% !important;"> | |||||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||||
<span>{{$.i18n.Tr "repo.modelarts.createtime"}}</span> | <span>{{$.i18n.Tr "repo.modelarts.createtime"}}</span> | ||||
</div> | </div> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | ||||
</div> | </div> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span>{{$.i18n.Tr "repo.modelarts.computing_resources"}}</span> | <span>{{$.i18n.Tr "repo.modelarts.computing_resources"}}</span> | ||||
</div> | </div> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | ||||
</div> | </div> | ||||
<div class="two wide column text center padding0"> | |||||
<div class="two wide column text center nowrap"> | |||||
<span>{{$.i18n.Tr "repository"}}</span> | <span>{{$.i18n.Tr "repository"}}</span> | ||||
</div> | </div> | ||||
<div class="two wide column text center padding0"> | |||||
<div class="two wide column text center nowrap"> | |||||
<span>{{.i18n.Tr "admin.cloudbrain.cloudbrain_name"}}</span> | <span>{{.i18n.Tr "admin.cloudbrain.cloudbrain_name"}}</span> | ||||
</div> | </div> | ||||
<div class="two wide column text center padding0" style="width: 17.5%!important;"> | |||||
<div class="two wide column text center nowrap" style="width: 17.5%!important;"> | |||||
<span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -63,49 +63,49 @@ | |||||
<div class="ui grid stackable item"> | <div class="ui grid stackable item"> | ||||
<div class="row"> | <div class="row"> | ||||
<!-- 任务名 --> | <!-- 任务名 --> | ||||
<div class="two wide column padding0"> | |||||
<div class="two wide column nowrap"> | |||||
{{if eq .JobType "DEBUG"}} | {{if eq .JobType "DEBUG"}} | ||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}/cloudbrain/{{.JobID}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/{{.JobName}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | <span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | ||||
</a> | </a> | ||||
{{else if eq .JobType "INFERENCE"}} | {{else if eq .JobType "INFERENCE"}} | ||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}/modelarts/inference-job/{{.JobID}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{.JobID}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | <span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | ||||
</a> | </a> | ||||
{{else if eq .JobType "TRAIN"}} | {{else if eq .JobType "TRAIN"}} | ||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}/modelarts/train-job/{{.JobID}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/train-job/{{.JobID}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | <span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | ||||
</a> | </a> | ||||
{{else if eq .JobType "BENCHMARK"}} | {{else if eq .JobType "BENCHMARK"}} | ||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}/cloudbrain/benchmark/{{.JobID}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{.JobName}}" title="{{.JobName}}" style="font-size: 14px;"> | |||||
<span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | <span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | ||||
</a> | </a> | ||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
<!-- 任务类型 --> | <!-- 任务类型 --> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span style="font-size: 12px;">{{.JobType}} </span> | <span style="font-size: 12px;">{{.JobType}} </span> | ||||
</div> | </div> | ||||
<!-- 任务状态 --> | <!-- 任务状态 --> | ||||
<div class="two wide column text center padding0" style="padding-left: 2.2rem !important; width: 10% !important;"> | |||||
<span class="job-status" id="{{.JobID}}" data-repopath='{{.Repo.OwnerName}}/{{.Repo.Alias}}{{if eq .JobType "DEBUG"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{else if eq .JobType "INFERENCE"}}/modelarts/inference-job{{else if eq .JobType "TRAIN"}}/modelarts/train-job{{else if eq .JobType "BENCHMARK"}}/cloudbrain{{end}}' data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> | |||||
<div class="two wide column text center nowrap" style="padding-left: 2.2rem !important; width: 10% !important;"> | |||||
<span class="job-status" id="{{.JobID}}" data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "DEBUG"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{else if eq .JobType "INFERENCE"}}/modelarts/inference-job{{else if eq .JobType "TRAIN"}}/modelarts/train-job{{else if eq .JobType "BENCHMARK"}}/cloudbrain{{end}}' data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> | |||||
<span><i id="{{.JobID}}-icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="{{.JobID}}-text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | <span><i id="{{.JobID}}-icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="{{.JobID}}-text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | ||||
</span> | </span> | ||||
</div> | </div> | ||||
<!-- 任务创建时间 --> | <!-- 任务创建时间 --> | ||||
<div class="two wide column text center padding0" style="width: 10% !important;"> | |||||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||||
<span style="font-size: 12px;" class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | <span style="font-size: 12px;" class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | ||||
</div> | </div> | ||||
<!-- 任务运行时间 --> | <!-- 任务运行时间 --> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span style="font-size: 12px;" id="duration-{{.JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | <span style="font-size: 12px;" id="duration-{{.JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | ||||
</div> | </div> | ||||
<!-- 计算资源 --> | <!-- 计算资源 --> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
<span style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | <span style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | ||||
</div> | </div> | ||||
<!-- 创建者 --> | <!-- 创建者 --> | ||||
<div class="one wide column text center padding0"> | |||||
<div class="one wide column text center nowrap"> | |||||
{{if .User.Name}} | {{if .User.Name}} | ||||
<a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | ||||
{{else}} | {{else}} | ||||
@@ -113,24 +113,24 @@ | |||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
<!-- 项目 --> | <!-- 项目 --> | ||||
<div class="two wide column text center padding0"> | |||||
<a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}" title="{{.Repo.OwnerName}}/{{.Repo.Alias}}">{{.Repo.OwnerName}}/{{.Repo.Alias}}</a> | |||||
<div class="two wide column text center nowrap"> | |||||
<a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}" title="{{.Repo.OwnerName}}/{{.Repo.Alias}}">{{.Repo.OwnerName}}/{{.Repo.Alias}}</a> | |||||
</div> | </div> | ||||
<!-- 云脑侧名称 --> | <!-- 云脑侧名称 --> | ||||
<div class="two wide column text center padding0" style="overflow: hidden;text-overflow:ellipsis;"> | |||||
<div class="two wide column text center nowrap" style="overflow: hidden;text-overflow:ellipsis;"> | |||||
<span class="fitted">{{.JobName}}</span> | <span class="fitted">{{.JobName}}</span> | ||||
</div> | </div> | ||||
<div class="two wide column text center padding0" style="width: 17.5%!important;"> | |||||
<div class="two wide column text center nowrap" style="width: 17.5%!important;"> | |||||
{{if eq .JobType "DEBUG"}} | {{if eq .JobType "DEBUG"}} | ||||
<div class="ui compact buttons"> | <div class="ui compact buttons"> | ||||
<form id="debugAgainForm-{{.JobID}}"> | <form id="debugAgainForm-{{.JobID}}"> | ||||
{{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
{{if eq .Status "RUNNING" "WAITING" "CREATING" "STARTING"}} | {{if eq .Status "RUNNING" "WAITING" "CREATING" "STARTING"}} | ||||
<a style="margin: 0 1rem;" id="ai-debug-{{.JobID}}" class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}}disabled {{else}}blue {{end}}button' data-jobid="{{.JobID}}" data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.JobID}}/'> | |||||
<a style="margin: 0 1rem;" id="ai-debug-{{.JobID}}" class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}}disabled {{else}}blue {{end}}button' data-jobid="{{.JobID}}" data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.JobID}}/'> | |||||
{{$.i18n.Tr "repo.debug"}} | {{$.i18n.Tr "repo.debug"}} | ||||
</a> | </a> | ||||
{{else}} | {{else}} | ||||
<a id="ai-debug-{{.JobID}}" class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' data-jobid="{{.JobID}}" data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.JobID}}/'> | |||||
<a id="ai-debug-{{.JobID}}" class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' data-jobid="{{.JobID}}" data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.JobID}}/'> | |||||
{{$.i18n.Tr "repo.debug_again"}} | {{$.i18n.Tr "repo.debug_again"}} | ||||
</a> | </a> | ||||
{{end}} | {{end}} | ||||
@@ -142,20 +142,20 @@ | |||||
{{if eq .JobType "DEBUG" "BENCHMARK"}} | {{if eq .JobType "DEBUG" "BENCHMARK"}} | ||||
<form id="stopForm-{{.JobID}}" style="margin-left:-1px;"> | <form id="stopForm-{{.JobID}}" style="margin-left:-1px;"> | ||||
{{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{.JobID}}" class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING"}}disabled {{else}} blue {{end}}button' data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{.JobID}}/stop' data-jobid="{{.JobID}}"> | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{.JobID}}" class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING"}}disabled {{else}} blue {{end}}button' data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{.JobID}}/stop' data-jobid="{{.JobID}}"> | |||||
{{$.i18n.Tr "repo.stop"}} | {{$.i18n.Tr "repo.stop"}} | ||||
</a> | </a> | ||||
</form> | </form> | ||||
{{else}} | {{else}} | ||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{.JobID}}" class="ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{else}} blue {{end}}button" data-repopath="{{.Repo.OwnerName}}/{{.Repo.Alias}}/modelarts/{{if eq .JobType "INFERENCE"}}inference-job{{else}}train-job{{end}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}" > | |||||
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{.JobID}}" class="ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{else}} blue {{end}}button" data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/{{if eq .JobType "INFERENCE"}}inference-job{{else}}train-job{{end}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}" > | |||||
{{$.i18n.Tr "repo.stop"}} | {{$.i18n.Tr "repo.stop"}} | ||||
</a> | </a> | ||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
<!-- 删除任务 --> | <!-- 删除任务 --> | ||||
<form class="ui compact buttons" id="delForm-{{.JobID}}" action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}/modelarts/train-job{{end}}/{{.JobID}}/del?isadminpage=true' method="post"> | |||||
<form class="ui compact buttons" id="delForm-{{.JobID}}" action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}/modelarts/train-job{{end}}/{{.JobID}}/del?isadminpage=true' method="post"> | |||||
{{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{.JobID}}" data-repopath="{{.Repo.OwnerName}}/{{.Repo.Alias}}/modelarts/inference-job/{{.JobID}}/del_version?isadminpage=true" data-version="{{.VersionName}}" class="ui basic ai_delete blue button" style="border-radius: .28571429rem;"> | |||||
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{.JobID}}" data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{.JobID}}/del_version?isadminpage=true" data-version="{{.VersionName}}" class="ui basic ai_delete blue button" style="border-radius: .28571429rem;"> | |||||
{{$.i18n.Tr "repo.delete"}} | {{$.i18n.Tr "repo.delete"}} | ||||
</a> | </a> | ||||
</form> | </form> | ||||
@@ -216,4 +216,5 @@ function getParams(){ | |||||
}) | }) | ||||
} | } | ||||
getParams() | getParams() | ||||
console.log({{.Tasks}}) | |||||
</script> | </script> |
@@ -15,6 +15,7 @@ | |||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=DEBUG&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="DEBUG">DEBUG</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=DEBUG&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="DEBUG">DEBUG</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=TRAIN&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="TRAIN">TRAIN</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=TRAIN&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="TRAIN">TRAIN</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=INFERENCE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="INFERENCE">INFERENCE</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=INFERENCE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="INFERENCE">INFERENCE</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BENCHMARK&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">BENCHMARK</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | ||||
@@ -35,7 +36,7 @@ | |||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=RESTARTING" data-value="NPU">RESTARTING </a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=RESTARTING" data-value="NPU">RESTARTING </a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=START_FAILED" data-value="all">START_FAILED</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=START_FAILED" data-value="all">START_FAILED</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPING" data-value="CPU/GPU">STOPPING</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPING" data-value="CPU/GPU">STOPPING</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPED}" data-value="NPU">STOPPED</a> | |||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPED" data-value="NPU">STOPPED</a> | |||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=WAITING" data-value="all">WAITING</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=WAITING" data-value="all">WAITING</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=COMPLETED" data-value="CPU/GPU">COMPLETED</a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=COMPLETED" data-value="CPU/GPU">COMPLETED</a> | ||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=FAILED" data-value="NPU">FAILED </a> | <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=FAILED" data-value="NPU">FAILED </a> | ||||
@@ -226,10 +226,12 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
let isShowNoticeTag = false; | let isShowNoticeTag = false; | ||||
let notices= {{.notices.Notices}} | let notices= {{.notices.Notices}} | ||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
if(notices != null && notices!=''){ | |||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
if (isShowNoticeTag){ | if (isShowNoticeTag){ | ||||
@@ -245,7 +247,9 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
}else{ | }else{ | ||||
document.getElementById("notic_content").style.display='none' | |||||
if (document.getElementById("notic_content") != null){ | |||||
document.getElementById("notic_content").style.display='none' | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -227,10 +227,12 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
let isShowNoticeTag = false; | let isShowNoticeTag = false; | ||||
let notices= {{.notices.Notices}} | let notices= {{.notices.Notices}} | ||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
if(notices != null && notices!=''){ | |||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
if (isShowNoticeTag){ | if (isShowNoticeTag){ | ||||
@@ -246,7 +248,9 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
}else{ | }else{ | ||||
document.getElementById("notic_content").style.display='none' | |||||
if (document.getElementById("notic_content") != null){ | |||||
document.getElementById("notic_content").style.display='none' | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -231,10 +231,12 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
let isShowNoticeTag = false; | let isShowNoticeTag = false; | ||||
let notices= {{.notices.Notices}} | let notices= {{.notices.Notices}} | ||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
if(notices != null && notices!=''){ | |||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
if (isShowNoticeTag){ | if (isShowNoticeTag){ | ||||
@@ -250,7 +252,9 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
}else{ | }else{ | ||||
document.getElementById("notic_content").style.display='none' | |||||
if (document.getElementById("notic_content") != null){ | |||||
document.getElementById("notic_content").style.display='none' | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -228,10 +228,12 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
let isShowNoticeTag = false; | let isShowNoticeTag = false; | ||||
let notices= {{.notices.Notices}} | let notices= {{.notices.Notices}} | ||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
if(notices != null && notices!=''){ | |||||
for (i =0;i<notices.length;i++){ | |||||
if (notices[i].Visible==1){ | |||||
isShowNoticeTag =true; | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
if (isShowNoticeTag){ | if (isShowNoticeTag){ | ||||
@@ -247,7 +249,9 @@ var _hmt = _hmt || []; | |||||
} | } | ||||
}else{ | }else{ | ||||
document.getElementById("notic_content").style.display='none' | |||||
if (document.getElementById("notic_content") != null){ | |||||
document.getElementById("notic_content").style.display='none' | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -7,7 +7,7 @@ | |||||
<div class="row"> | <div class="row"> | ||||
<div class="eight wide column" data-tooltip="{{.Name}}"> | <div class="eight wide column" data-tooltip="{{.Name}}"> | ||||
<span class="ui right">{{.Size | FileSize}}</span> | <span class="ui right">{{.Size | FileSize}}</span> | ||||
<a class="title" href="{{.DownloadURL}}?type={{$.Type}}"> | |||||
<a class="title" href="{{.DownloadURL}}"> | |||||
{{svg "octicon-cloud-download" 16}} {{.Name}} | {{svg "octicon-cloud-download" 16}} {{.Name}} | ||||
</a> | </a> | ||||
</div> | </div> | ||||
@@ -132,7 +132,7 @@ | |||||
{{end}} --> | {{end}} --> | ||||
{{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} | {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} | ||||
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls"> | |||||
<a class="{{if or .PageIsComparePull .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls"> | |||||
{{svg "octicon-git-pull-request" 16}} {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span> | {{svg "octicon-git-pull-request" 16}} {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span> | ||||
</a> | </a> | ||||
{{end}} | {{end}} | ||||
@@ -19,7 +19,7 @@ | |||||
<div class="repository new repo ui middle very relaxed page grid"> | <div class="repository new repo ui middle very relaxed page grid"> | ||||
<div class="column"> | <div class="column"> | ||||
{{template "base/alert" .}} | {{template "base/alert" .}} | ||||
<div class="ui positive message" id="messageInfo"> | |||||
<div class="ui negative message" id="messageInfo"> | |||||
<p></p> | <p></p> | ||||
</div> | </div> | ||||
<form class="ui form" id="form_id" action="{{.Link}}" method="post"> | <form class="ui form" id="form_id" action="{{.Link}}" method="post"> | ||||
@@ -8,7 +8,6 @@ export default async function initCloudrain() { | |||||
// const computeResource = job.dataset.resource | // const computeResource = job.dataset.resource | ||||
const versionname = job.dataset.version | const versionname = job.dataset.version | ||||
const status_text = $(`#${jobID}-text`).text() | const status_text = $(`#${jobID}-text`).text() | ||||
console.log(versionname) | |||||
const finalState = ['STOPPED','CREATE_FAILED','UNAVAILABLE','DELETED','RESIZE_FAILED','SUCCEEDED','IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED','SUBMIT_MODEL_FAILED','DEPLOY_SERVICE_FAILED','CHECK_FAILED'] | const finalState = ['STOPPED','CREATE_FAILED','UNAVAILABLE','DELETED','RESIZE_FAILED','SUCCEEDED','IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED','SUBMIT_MODEL_FAILED','DEPLOY_SERVICE_FAILED','CHECK_FAILED'] | ||||
if (finalState.includes(status_text)) { | if (finalState.includes(status_text)) { | ||||
return | return | ||||
@@ -3601,17 +3601,27 @@ function initVueApp() { | |||||
uid: Number( | uid: Number( | ||||
(document.querySelector('meta[name=_context_uid]') || {}).content | (document.querySelector('meta[name=_context_uid]') || {}).content | ||||
), | ), | ||||
activityTopAuthors: window.ActivityTopAuthors || [] | |||||
activityTopAuthors: window.ActivityTopAuthors || [], | |||||
localHref:'' | |||||
}, | }, | ||||
components: { | components: { | ||||
ActivityTopAuthors | ActivityTopAuthors | ||||
}, | }, | ||||
mounted(){ | mounted(){ | ||||
this.page = parseInt(new URLSearchParams(window.location.search).get('page')) | this.page = parseInt(new URLSearchParams(window.location.search).get('page')) | ||||
this.localHref = location.href | |||||
}, | }, | ||||
methods:{ | methods:{ | ||||
handleCurrentChange:function (val) { | handleCurrentChange:function (val) { | ||||
window.location.href='/admin/cloudbrains?page='+val | |||||
const searchParams = new URLSearchParams(window.location.search) | |||||
if (!window.location.search) { | |||||
window.location.href = this.localHref + '?page='+val | |||||
} else if (searchParams.has('page')) { | |||||
window.location.href = this.localHref.replace(/page=[0-9]/g,'page='+val) | |||||
} else { | |||||
window.location.href=location.href+'&page='+val | |||||
} | |||||
this.page = val | this.page = val | ||||
} | } | ||||
} | } | ||||
@@ -1,6 +1,11 @@ | |||||
a { | a { | ||||
color: #0366d6; | color: #0366d6; | ||||
} | } | ||||
.nowrap{ | |||||
white-space: nowrap; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
} | |||||
.ui .text.yellow a { | .ui .text.yellow a { | ||||
color: #fbbd08!important | color: #fbbd08!important | ||||
} | } | ||||