|
|
|
@@ -393,6 +393,15 @@ func ModelSafetyGetLog(ctx *context.APIContext) { |
|
|
|
} |
|
|
|
if job.JobType == string(models.JobTypeModelSafety) { |
|
|
|
if job.Type == models.TypeCloudBrainOne { |
|
|
|
result, err := cloudbrain.GetJob(job.JobID) |
|
|
|
existStr := "" |
|
|
|
if err == nil && result != nil { |
|
|
|
jobRes, _ := models.ConvertToJobResultPayload(result.Payload) |
|
|
|
taskRoles := jobRes.TaskRoles |
|
|
|
taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) |
|
|
|
existStr = taskRes.TaskStatuses[0].ExitDiagnostics |
|
|
|
} |
|
|
|
ctx.Data["existStr"] = existStr |
|
|
|
CloudbrainGetLog(ctx) |
|
|
|
} else if job.Type == models.TypeCloudBrainTwo { |
|
|
|
TrainJobForModelConvertGetLog(ctx) |
|
|
|
@@ -487,12 +496,19 @@ func CloudbrainGetLog(ctx *context.APIContext) { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
content := "" |
|
|
|
if result["Content"] != nil { |
|
|
|
content = result["Content"].(string) |
|
|
|
} |
|
|
|
if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { |
|
|
|
content = content + ctx.Data["existStr"].(string) |
|
|
|
} |
|
|
|
re := map[string]interface{}{ |
|
|
|
"JobID": ID, |
|
|
|
"LogFileName": result["FileName"], |
|
|
|
"StartLine": result["StartLine"], |
|
|
|
"EndLine": result["EndLine"], |
|
|
|
"Content": result["Content"], |
|
|
|
"Content": content, |
|
|
|
"Lines": result["Lines"], |
|
|
|
"CanLogDownload": result["FileName"] != "", |
|
|
|
} |
|
|
|
|