| @@ -45,7 +45,7 @@ type ImageStar struct { | |||
| } | |||
| type ImageTopic struct { | |||
| ID int64 | |||
| ID int64 `xorm:"pk autoincr"` | |||
| Name string `xorm:"UNIQUE VARCHAR(105)"` | |||
| ImageCount int | |||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||
| @@ -468,8 +468,13 @@ func (images ImageList) loadAttributes(e Engine, uid int64) error { | |||
| } | |||
| for i := range images { | |||
| images[i].UserName = users[images[i].UID].Name | |||
| images[i].RelAvatarLink = users[images[i].UID].RelAvatarLink() | |||
| if users[images[i].UID] != nil { | |||
| images[i].UserName = users[images[i].UID].Name | |||
| images[i].RelAvatarLink = users[images[i].UID].RelAvatarLink() | |||
| } else { | |||
| images[i].UserName = "" | |||
| images[i].RelAvatarLink = "" | |||
| } | |||
| if uid == -1 { | |||
| images[i].IsStar = false | |||
| } else { | |||
| @@ -491,34 +491,22 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||
| } | |||
| } | |||
| taskRoles := jobRes.TaskRoles | |||
| if jobRes.JobStatus.State != string(models.JobFailed) { | |||
| taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) | |||
| ctx.Data["taskRes"] = taskRes | |||
| task.Status = taskRes.TaskStatuses[0].State | |||
| task.ContainerID = taskRes.TaskStatuses[0].ContainerID | |||
| task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP | |||
| models.ParseAndSetDurationFromCloudBrainOne(jobRes, task) | |||
| if task.DeletedAt.IsZero() { //normal record | |||
| err = models.UpdateJob(task) | |||
| if err != nil { | |||
| ctx.Data["error"] = err.Error() | |||
| return | |||
| } | |||
| } else { //deleted record | |||
| taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) | |||
| ctx.Data["taskRes"] = taskRes | |||
| ctx.Data["ExitDiagnostics"] = taskRes.TaskStatuses[0].ExitDiagnostics | |||
| task.Status = taskRes.TaskStatuses[0].State | |||
| task.ContainerID = taskRes.TaskStatuses[0].ContainerID | |||
| task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP | |||
| models.ParseAndSetDurationFromCloudBrainOne(jobRes, task) | |||
| if task.DeletedAt.IsZero() { //normal record | |||
| err = models.UpdateJob(task) | |||
| if err != nil { | |||
| ctx.Data["error"] = err.Error() | |||
| return | |||
| } | |||
| } else { | |||
| task.Status = jobRes.JobStatus.State | |||
| taskRes := models.TaskPod{TaskStatuses: []models.TaskStatuses{ | |||
| { | |||
| State: jobRes.JobStatus.State, | |||
| }, | |||
| }} | |||
| ctx.Data["taskRes"] = taskRes | |||
| jobRes.JobStatus.StartTime = time.Unix(int64(task.CreatedUnix), 0).Format("2006-01-02 15:04:05") | |||
| jobRes.JobStatus.EndTime = time.Unix(int64(task.UpdatedUnix), 0).Format("2006-01-02 15:04:05") | |||
| } else { //deleted record | |||
| } | |||
| ctx.Data["result"] = jobRes | |||
| @@ -1,4 +1,4 @@ | |||
| <a href="https://openi.org.cn/html/2020/qimengxingdong_0813/450.html" target="_blank"><img class="ui mini image" src="/img/banner-qimen-4X3.jpg" style="width:100%;"></a> | |||
| <a href="https://openi.org.cn/index.php?m=content&c=index&a=lists&catid=208" target="_blank"><img class="ui mini image" src="https://openi.org.cn/uploadfile/2022/0507/e8bdd42ed598f12.jpg" style="width:100%;"></a> | |||
| <div class="ui secondary pointing menu"> | |||
| <div class="active item"> | |||
| @@ -15,7 +15,7 @@ | |||
| <span class="help">{{.i18n.Tr "org.org_name_helper"}}</span> | |||
| </div> | |||
| <div class="inline field {{if .Err_OrgVisibility}}error{{end}}"> | |||
| <!-- <div class="inline field {{if .Err_OrgVisibility}}error{{end}}"> | |||
| <span class="inline required field"><label for="visibility">{{.i18n.Tr "org.settings.visibility"}}</label></span> | |||
| <div class="inline-grouped-list"> | |||
| <div class="ui radio checkbox"> | |||
| @@ -31,7 +31,7 @@ | |||
| <label>{{.i18n.Tr "org.settings.visibility.private"}}</label> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> --> | |||
| <div class="inline field" id="permission_box"> | |||
| <label>{{.i18n.Tr "org.settings.permission"}}</label> | |||
| @@ -43,13 +43,13 @@ | |||
| </div> | |||
| </div> | |||
| <div class="field"> | |||
| <div class="ui radio checkbox"> | |||
| <div class="ui radio disabled checkbox"> | |||
| <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}/> | |||
| <label>{{.i18n.Tr "org.settings.visibility.limited"}}</label> | |||
| </div> | |||
| </div> | |||
| <div class="field"> | |||
| <div class="ui radio checkbox"> | |||
| <div class="ui radio disabled checkbox"> | |||
| <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}/> | |||
| <label>{{.i18n.Tr "org.settings.visibility.private"}}</label> | |||
| </div> | |||
| @@ -516,17 +516,21 @@ td, th { | |||
| let podEventArray = podEvents[task0]; | |||
| if(podEventArray != null){ | |||
| for(var i=0; i < podEventArray.length;i++){ | |||
| html +="<p><b>[" +podEventArray[i]["reason"] + "]</b></p>"; | |||
| html +="<p>" +podEventArray[i]["message"] + "</p>"; | |||
| html +="<p>" +podEventArray[i]["action"] + "</p>"; | |||
| if (podEventArray[i]["reason"]!="") { | |||
| html +="<p><b>[" +podEventArray[i]["reason"] + "]</b></p>"; | |||
| html +="<p>" +podEventArray[i]["message"] + "</p>"; | |||
| html +="<p>" +podEventArray[i]["action"] + "</p>"; | |||
| } | |||
| } | |||
| } | |||
| let extras= jsonObj["extras"]; | |||
| if(extras != null){ | |||
| for(var i=0; i < extras.length;i++){ | |||
| html +="<p><b>[" +extras[i]["reason"] + "]</b></p>"; | |||
| html +="<p>" +extras[i]["message"] + "</p>"; | |||
| html +="<p>" +extras[i]["action"] + "</p>"; | |||
| if (extras[i]["reason"]!="") { | |||
| html +="<p><b>[" +extras[i]["reason"] + "]</b></p>"; | |||
| html +="<p>" +extras[i]["message"] + "</p>"; | |||
| html +="<p>" +extras[i]["action"] + "</p>"; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -102,6 +102,11 @@ | |||
| td, th { | |||
| padding: 0; | |||
| } | |||
| .info_text { | |||
| padding-bottom: 20px; | |||
| padding-right: 20px; | |||
| font-size: 12px; | |||
| } | |||
| .ac-grid-col .text-span { | |||
| width: 450px; | |||
| overflow: hidden; | |||
| @@ -214,8 +219,9 @@ td, th { | |||
| <div class="content-pad"> | |||
| <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);"> | |||
| <a class="active item" data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||
| <a class="item" data-tab="second{{$k}}" onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||
| <a class="item" data-tab="third{{$k}}" onclick="loadModelFile({{.VersionName}},'','','init')">{{$.i18n.Tr "repo.model_download"}}</a> | |||
| <a class="item" data-tab="second{{$k}}" onclick="javascript:parseInfo()">{{$.i18n.Tr "repo.cloudbrain.runinfo"}}</a> | |||
| <a class="item" data-tab="third{{$k}}" onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||
| <a class="item" data-tab="four{{$k}}" onclick="loadModelFile({{.VersionName}},'','','init')">{{$.i18n.Tr "repo.model_download"}}</a> | |||
| </div> | |||
| <div class="ui tab active" data-tab="first{{$k}}"> | |||
| <div style="padding-top: 10px;"> | |||
| @@ -376,7 +382,25 @@ td, th { | |||
| </div> | |||
| </div> | |||
| <div class="ui tab" data-tab="second{{$k}}"> | |||
| <div> | |||
| <div class="ui message message{{.VersionName}}" style="display: none;"> | |||
| <div id="header"></div> | |||
| </div> | |||
| <div class="ui attached log" id="log{{.VersionName}}" style="height: 390px !important; overflow: auto;"> | |||
| <input type="hidden" id="json_value" value="{{$.result.JobStatus.AppExitDiagnostics}}"> | |||
| <input type="hidden" id="ExitDiagnostics" value="{{$.ExitDiagnostics}}"> | |||
| <span id="info_display" class="info_text"> | |||
| </span> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="ui tab" data-tab="third{{$k}}"> | |||
| <div> | |||
| <div class="ui message message{{.VersionName}}" style="display: none;"> | |||
| <div id="header"></div> | |||
| @@ -391,7 +415,7 @@ td, th { | |||
| </div> | |||
| <div class="ui tab" data-tab="third{{$k}}"> | |||
| <div class="ui tab" data-tab="four{{$k}}"> | |||
| <input type="hidden" name="model{{.VersionName}}" value="-1"> | |||
| <input type="hidden" name="modelback{{.VersionName}}" value="-1"> | |||
| <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'> | |||
| @@ -609,10 +633,10 @@ td, th { | |||
| // } | |||
| let status = $(`#${versionname}-status-span`).text() | |||
| if(['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED','SUCCEEDED'].includes(status)){ | |||
| if(['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED','SUCCEEDED','STOPPED'].includes(status)){ | |||
| return | |||
| } | |||
| let stopArray=["KILLED","FAILED","START_FAILED","KILLING","COMPLETED","SUCCEEDED"] | |||
| let stopArray=["KILLED","FAILED","START_FAILED","KILLING","COMPLETED","SUCCEEDED","STOPPED"] | |||
| $.get(`/api/v1/repos/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => { | |||
| //$(`#${versionname}-duration-span`).text(data.JobDuration) | |||
| $(`#${versionname}-status-span span`).text(data.JobStatus) | |||
| @@ -649,5 +673,48 @@ td, th { | |||
| }); | |||
| stopBubbling(arguments.callee.caller.arguments[0]) | |||
| } | |||
| function parseInfo(){ | |||
| let jsonValue = document.getElementById("json_value").value; | |||
| let jsonObj = JSON.parse(jsonValue); | |||
| let podRoleName = jsonObj["podRoleName"]; | |||
| let html = ""; | |||
| if (podRoleName != null){ | |||
| let task0 = podRoleName["task1-0"]; | |||
| let podEvents = jsonObj["podEvents"]; | |||
| let podEventArray = podEvents[task0]; | |||
| if(podEventArray != null){ | |||
| for(var i=0; i < podEventArray.length;i++){ | |||
| if (podEventArray[i]["reason"]!="") { | |||
| html +="<p><b>[" +podEventArray[i]["reason"] + "]</b></p>"; | |||
| html +="<p>" +podEventArray[i]["message"] + "</p>"; | |||
| html +="<p>" +podEventArray[i]["action"] + "</p>"; | |||
| } | |||
| } | |||
| } | |||
| let extras= jsonObj["extras"]; | |||
| if(extras != null){ | |||
| for(var i=0; i < extras.length;i++){ | |||
| if (extras[i]["reason"]!="") { | |||
| html +="<p><b>[" +extras[i]["reason"] + "]</b></p>"; | |||
| html +="<p>" +extras[i]["message"] + "</p>"; | |||
| html +="<p>" +extras[i]["action"] + "</p>"; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| let string = document.getElementById("ExitDiagnostics").value; | |||
| string = string.replace(/\r\n/g,"<br>") | |||
| string = string.replace(/\n/g,"<br>"); | |||
| string = string.replace(/(\r\n)|(\n)/g,'<br>'); | |||
| if (string!=""){ | |||
| html +="<p><b>[ExitDiagnostics]</b></p>"; | |||
| html +="<p>" +string + "</p>"; | |||
| } | |||
| document.getElementById("info_display").innerHTML=html; | |||
| } | |||
| </script> | |||
| @@ -239,7 +239,7 @@ const params = new URLSearchParams(location.search) | |||
| if(!location.search){ | |||
| $('.default.text').text(all) | |||
| }else{ | |||
| if(params.has('listType') && params.get('listType')=='all'){ | |||
| if(!params.has('listType') || params.get('listType')=='all'){ | |||
| $('.default.text').text(all) | |||
| } | |||
| else{ | |||