|
|
@@ -50,6 +50,15 @@ func CloudBrainIndex(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
timestamp := time.Now().Unix() |
|
|
|
for i, task := range ciTasks { |
|
|
|
if task.Status == string(models.JobRunning) && (timestamp - int64(task.CreatedUnix) > 30){ |
|
|
|
ciTasks[i].CanDebug = true |
|
|
|
} else { |
|
|
|
ciTasks[i].CanDebug = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) |
|
|
|
pager.SetDefaultParams(ctx) |
|
|
|
ctx.Data["Page"] = pager |
|
|
@@ -153,12 +162,31 @@ func CloudBrainShow(ctx *context.Context) { |
|
|
|
taskRoles := jobRes.TaskRoles |
|
|
|
taskRes, _ := models.ConvertToTaskPod(taskRoles["task1"].(map[string]interface{})) |
|
|
|
ctx.Data["taskRes"] = taskRes |
|
|
|
task.Status = taskRes.TaskStatuses[0].State |
|
|
|
err = models.UpdateJob(task) |
|
|
|
if err != nil { |
|
|
|
ctx.Data["error"] = err.Error() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ctx.Data["jobID"] = jobID |
|
|
|
ctx.HTML(200, tplCloudBrainShow) |
|
|
|
} |
|
|
|
|
|
|
|
func CloudBrainDebug(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
|
|
|
|
var jobID = ctx.Params(":jobid") |
|
|
|
task, err := models.GetCloudbrainByJobID(jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("GetCloudbrainByJobID failed", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
debugUrl := setting.DebugServerHost + "jpylab_" + task.JobID + "_" + task.SubTaskName |
|
|
|
ctx.Redirect(debugUrl) |
|
|
|
} |
|
|
|
|
|
|
|
func downloadCode(repo *models.Repository, codePath string) error { |
|
|
|
/* |
|
|
|
if err := git.Clone(repo.RepoPath(), codePath, git.CloneRepoOptions{ |
|
|
|