|
|
@@ -223,7 +223,7 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func RestartTask(ctx *context.Context, task *models.Cloudbrain) error { |
|
|
|
|
|
|
|
|
func RestartTask(ctx *context.Context, task *models.Cloudbrain, newJobID *string) error { |
|
|
dataActualPath := setting.Attachment.Minio.RealPath + |
|
|
dataActualPath := setting.Attachment.Minio.RealPath + |
|
|
setting.Attachment.Minio.Bucket + "/" + |
|
|
setting.Attachment.Minio.Bucket + "/" + |
|
|
setting.Attachment.Minio.BasePath + |
|
|
setting.Attachment.Minio.BasePath + |
|
|
@@ -313,7 +313,7 @@ func RestartTask(ctx *context.Context, task *models.Cloudbrain) error { |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("CreateJob failed:", err.Error(), ctx.Data["MsgID"]) |
|
|
|
|
|
|
|
|
log.Error("CreateJob failed:%v", err.Error(), ctx.Data["MsgID"]) |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
if jobResult.Code != Success { |
|
|
if jobResult.Code != Success { |
|
|
@@ -322,14 +322,29 @@ func RestartTask(ctx *context.Context, task *models.Cloudbrain) error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var jobID = jobResult.Payload["jobId"].(string) |
|
|
var jobID = jobResult.Payload["jobId"].(string) |
|
|
task.JobID = jobID |
|
|
|
|
|
task.Status = string(models.JobWaiting) |
|
|
|
|
|
err = models.UpdateJob(task) |
|
|
|
|
|
|
|
|
newTask := &models.Cloudbrain{ |
|
|
|
|
|
Status: string(models.JobWaiting), |
|
|
|
|
|
UserID: task.UserID, |
|
|
|
|
|
RepoID: task.RepoID, |
|
|
|
|
|
JobID: jobID, |
|
|
|
|
|
JobName: task.JobName, |
|
|
|
|
|
SubTaskName: task.SubTaskName, |
|
|
|
|
|
JobType: task.JobType, |
|
|
|
|
|
Type: task.Type, |
|
|
|
|
|
Uuid: task.Uuid, |
|
|
|
|
|
Image: task.Image, |
|
|
|
|
|
GpuQueue: task.GpuQueue, |
|
|
|
|
|
ResourceSpecId: task.ResourceSpecId, |
|
|
|
|
|
ComputeResource: task.ComputeResource, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = models.RestartCloudbrain(task, newTask) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("UpdateJob(%s) failed:%v", jobName, err.Error(), ctx.Data["MsgID"]) |
|
|
|
|
|
|
|
|
log.Error("RestartCloudbrain(%s) failed:%v", jobName, err.Error(), ctx.Data["MsgID"]) |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
*newJobID = jobID |
|
|
|
|
|
|
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |