| @@ -357,7 +357,7 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job | |||||
| CommitID: req.CommitID, | CommitID: req.CommitID, | ||||
| IsLatestVersion: req.IsLatestVersion, | IsLatestVersion: req.IsLatestVersion, | ||||
| PreVersionName: req.PreVersionName, | PreVersionName: req.PreVersionName, | ||||
| ComputeResource: models.GPUResource, | |||||
| ComputeResource: models.NPUResource, | |||||
| EngineID: req.EngineID, | EngineID: req.EngineID, | ||||
| TrainUrl: req.TrainUrl, | TrainUrl: req.TrainUrl, | ||||
| BranchName: req.BranchName, | BranchName: req.BranchName, | ||||
| @@ -6,6 +6,7 @@ package util | |||||
| import ( | import ( | ||||
| "bytes" | "bytes" | ||||
| "strconv" | |||||
| "strings" | "strings" | ||||
| ) | ) | ||||
| @@ -100,3 +101,12 @@ func NormalizeEOL(input []byte) []byte { | |||||
| } | } | ||||
| return tmp[:pos] | return tmp[:pos] | ||||
| } | } | ||||
| func AddZero(t int64) (m string) { | |||||
| if t < 10 { | |||||
| m = "0" + strconv.FormatInt(t, 10) | |||||
| return m | |||||
| } else { | |||||
| return strconv.FormatInt(t, 10) | |||||
| } | |||||
| } | |||||
| @@ -2659,3 +2659,5 @@ foot.member_news = Member news | |||||
| foot.industry_advisory = Industry Advisory | foot.industry_advisory = Industry Advisory | ||||
| foot.help = help | foot.help = help | ||||
| foot.copyright= Copyright: New Generation Artificial Intelligence Open Source Open Platform (OpenI) | foot.copyright= Copyright: New Generation Artificial Intelligence Open Source Open Platform (OpenI) | ||||
| Platform_Tutorial=Platform Tutorial | |||||
| foot.advice_feedback=advice feedback | |||||
| @@ -2667,3 +2667,5 @@ foot.member_news=成员动态 | |||||
| foot.industry_advisory=行业资讯 | foot.industry_advisory=行业资讯 | ||||
| foot.help=帮助 | foot.help=帮助 | ||||
| foot.copyright= 版权所有:新一代人工智能开源开放平台(OpenI) | foot.copyright= 版权所有:新一代人工智能开源开放平台(OpenI) | ||||
| Platform_Tutorial=新手指引 | |||||
| foot.advice_feedback = 意见反馈 | |||||
| @@ -6,6 +6,7 @@ | |||||
| package repo | package repo | ||||
| import ( | import ( | ||||
| "code.gitea.io/gitea/modules/util" | |||||
| "net/http" | "net/http" | ||||
| "strconv" | "strconv" | ||||
| "strings" | "strings" | ||||
| @@ -106,7 +107,7 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { | |||||
| job.TrainJobDuration = result.TrainJobDuration | job.TrainJobDuration = result.TrainJobDuration | ||||
| if result.Duration != 0 { | if result.Duration != 0 { | ||||
| job.TrainJobDuration = addZero(result.Duration/3600000) + ":" + addZero(result.Duration%3600000/60000) + ":" + addZero(result.Duration%60000/1000) | |||||
| job.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) | |||||
| } else { | } else { | ||||
| job.TrainJobDuration = "00:00:00" | job.TrainJobDuration = "00:00:00" | ||||
| @@ -125,15 +126,6 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { | |||||
| } | } | ||||
| func addZero(t int64) (m string) { | |||||
| if t < 10 { | |||||
| m = "0" + strconv.FormatInt(t, 10) | |||||
| return m | |||||
| } else { | |||||
| return strconv.FormatInt(t, 10) | |||||
| } | |||||
| } | |||||
| func TrainJobGetLog(ctx *context.APIContext) { | func TrainJobGetLog(ctx *context.APIContext) { | ||||
| var ( | var ( | ||||
| err error | err error | ||||
| @@ -14,18 +14,17 @@ import ( | |||||
| "strings" | "strings" | ||||
| "time" | "time" | ||||
| "code.gitea.io/gitea/modules/modelarts" | |||||
| "code.gitea.io/gitea/modules/git" | |||||
| "code.gitea.io/gitea/modules/storage" | |||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| "code.gitea.io/gitea/modules/auth" | "code.gitea.io/gitea/modules/auth" | ||||
| "code.gitea.io/gitea/modules/base" | "code.gitea.io/gitea/modules/base" | ||||
| "code.gitea.io/gitea/modules/cloudbrain" | "code.gitea.io/gitea/modules/cloudbrain" | ||||
| "code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
| "code.gitea.io/gitea/modules/git" | |||||
| "code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
| "code.gitea.io/gitea/modules/modelarts" | |||||
| "code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
| "code.gitea.io/gitea/modules/storage" | |||||
| "code.gitea.io/gitea/modules/util" | |||||
| ) | ) | ||||
| const ( | const ( | ||||
| @@ -277,7 +276,7 @@ func CloudBrainRestart(ctx *context.Context) { | |||||
| break | break | ||||
| } | } | ||||
| if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()){ | |||||
| if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()) { | |||||
| log.Error("the user has no right ro restart the job", task.JobName, ctx.Data["MsgID"]) | log.Error("the user has no right ro restart the job", task.JobName, ctx.Data["MsgID"]) | ||||
| resultCode = "-1" | resultCode = "-1" | ||||
| errorMsg = "you have no right to restart the job" | errorMsg = "you have no right to restart the job" | ||||
| @@ -949,6 +948,13 @@ func SyncCloudbrainStatus() { | |||||
| task.Duration = result.Duration | task.Duration = result.Duration | ||||
| task.TrainJobDuration = result.TrainJobDuration | task.TrainJobDuration = result.TrainJobDuration | ||||
| if result.Duration != 0 { | |||||
| task.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) | |||||
| } else { | |||||
| task.TrainJobDuration = "00:00:00" | |||||
| } | |||||
| err = models.UpdateJob(task) | err = models.UpdateJob(task) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("UpdateJob(%s) failed:%v", task.JobName, err) | log.Error("UpdateJob(%s) failed:%v", task.JobName, err) | ||||
| @@ -26,7 +26,14 @@ | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <a href="https://git.openi.org.cn/zeizei/OpenI_Learning" class="ui item" target="_blank">{{.i18n.Tr "custom.Platform_Tutorial"}}</a> | |||||
| {{if .EnableSwagger}}<a href="/api/swagger" class="ui item">API</a>{{end}} | {{if .EnableSwagger}}<a href="/api/swagger" class="ui item">API</a>{{end}} | ||||
| {{if .IsSigned}} | |||||
| <a href="https://git.openi.org.cn/zeizei/OpenI_Learning/issues/new" class="ui item" target="_blank">{{.i18n.Tr "custom.foot.advice_feedback"}}</a> | |||||
| {{else}} | |||||
| <a href="{{AppSubUrl}}/user/login" class="ui item">{{.i18n.Tr "custom.foot.advice_feedback"}}</a> | |||||
| {{end}} | |||||
| {{template "custom/extra_links_footer" .}} | {{template "custom/extra_links_footer" .}} | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -26,7 +26,13 @@ | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <a href="https://git.openi.org.cn/zeizei/OpenI_Learning" class="ui item" target="_blank">{{.i18n.Tr "custom.Platform_Tutorial"}}</a> | |||||
| {{if .EnableSwagger}}<a href="/api/swagger" class="ui item">API</a>{{end}} | {{if .EnableSwagger}}<a href="/api/swagger" class="ui item">API</a>{{end}} | ||||
| {{if .IsSigned}} | |||||
| <a href="https://git.openi.org.cn/zeizei/OpenI_Learning/issues/new" class="ui item" target="_blank">{{.i18n.Tr "custom.foot.advice_feedback"}}</a> | |||||
| {{else}} | |||||
| <a href="{{AppSubUrl}}/user/login" class="ui item">{{.i18n.Tr "custom.foot.advice_feedback"}}</a> | |||||
| {{end}} | |||||
| {{template "custom/extra_links_footer" .}} | {{template "custom/extra_links_footer" .}} | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -168,6 +168,14 @@ | |||||
| {{svg "octicon-question" 16}} | {{svg "octicon-question" 16}} | ||||
| {{.i18n.Tr "help"}}<!-- Help --> | {{.i18n.Tr "help"}}<!-- Help --> | ||||
| </a--> | </a--> | ||||
| <a class="item" href="https://git.openi.org.cn/zeizei/OpenI_Learning" target="_blank"> | |||||
| <i class="tutorial_icon"> | |||||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||||
| <path fill="none" d="M0 0h24v24H0z"/><path d="M2 3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993H2.992A.993.993 0 0 1 2 20.007V3.993zM12 5v14h8V5h-8zm1 2h6v2h-6V7zm0 3h6v2h-6v-2z"/> | |||||
| </svg> | |||||
| </i> | |||||
| {{.i18n.Tr "custom.Platform_Tutorial"}} | |||||
| </a> | |||||
| {{if .IsAdmin}} | {{if .IsAdmin}} | ||||
| <div class="divider"></div> | <div class="divider"></div> | ||||
| @@ -166,6 +166,14 @@ | |||||
| {{svg "octicon-question" 16}} | {{svg "octicon-question" 16}} | ||||
| {{.i18n.Tr "help"}}<!-- Help --> | {{.i18n.Tr "help"}}<!-- Help --> | ||||
| </a--> | </a--> | ||||
| <a class="item" href="https://git.openi.org.cn/zeizei/OpenI_Learning" target="_blank"> | |||||
| <i class="tutorial_icon"> | |||||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||||
| <path fill="none" d="M0 0h24v24H0z"/><path d="M2 3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993H2.992A.993.993 0 0 1 2 20.007V3.993zM12 5v14h8V5h-8zm1 2h6v2h-6V7zm0 3h6v2h-6v-2z"/> | |||||
| </svg> | |||||
| </i> | |||||
| {{.i18n.Tr "custom.Platform_Tutorial"}} | |||||
| </a> | |||||
| {{if .IsAdmin}} | {{if .IsAdmin}} | ||||
| <div class="divider"></div> | <div class="divider"></div> | ||||
| @@ -148,6 +148,14 @@ | |||||
| {{svg "octicon-question" 16}} | {{svg "octicon-question" 16}} | ||||
| {{.i18n.Tr "help"}}<!-- Help --> | {{.i18n.Tr "help"}}<!-- Help --> | ||||
| </a--> | </a--> | ||||
| <a class="item" href="https://git.openi.org.cn/zeizei/OpenI_Learning" target="_blank"> | |||||
| <i class="tutorial_icon"> | |||||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||||
| <path fill="none" d="M0 0h24v24H0z"/><path d="M2 3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993H2.992A.993.993 0 0 1 2 20.007V3.993zM12 5v14h8V5h-8zm1 2h6v2h-6V7zm0 3h6v2h-6v-2z"/> | |||||
| </svg> | |||||
| </i> | |||||
| {{.i18n.Tr "custom.Platform_Tutorial"}} | |||||
| </a> | |||||
| {{if .IsAdmin}} | {{if .IsAdmin}} | ||||
| <div class="divider"></div> | <div class="divider"></div> | ||||
| @@ -169,6 +169,14 @@ | |||||
| {{svg "octicon-question" 16}} | {{svg "octicon-question" 16}} | ||||
| {{.i18n.Tr "help"}}<!-- Help --> | {{.i18n.Tr "help"}}<!-- Help --> | ||||
| </a--> | </a--> | ||||
| <a class="item" href="https://git.openi.org.cn/zeizei/OpenI_Learning" target="_blank"> | |||||
| <i class="tutorial_icon"> | |||||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||||
| <path fill="none" d="M0 0h24v24H0z"/><path d="M2 3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993H2.992A.993.993 0 0 1 2 20.007V3.993zM12 5v14h8V5h-8zm1 2h6v2h-6V7zm0 3h6v2h-6v-2z"/> | |||||
| </svg> | |||||
| </i> | |||||
| {{.i18n.Tr "custom.Platform_Tutorial"}} | |||||
| </a> | |||||
| {{if .IsAdmin}} | {{if .IsAdmin}} | ||||
| <div class="divider"></div> | <div class="divider"></div> | ||||
| @@ -585,3 +585,7 @@ display: block; | |||||
| margin-top: 0.7rem; | margin-top: 0.7rem; | ||||
| color: #888888; | color: #888888; | ||||
| } | } | ||||
| .tutorial_icon{ | |||||
| vertical-align: middle; | |||||
| margin-right: 0.75em; | |||||
| } | |||||