|
|
|
@@ -11,9 +11,10 @@ import ( |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/modelarts" |
|
|
|
"net/http" |
|
|
|
"strconv" |
|
|
|
) |
|
|
|
|
|
|
|
func GetModelArtsTask(ctx *context.APIContext) { |
|
|
|
func GetModelArtsNotebook(ctx *context.APIContext) { |
|
|
|
var ( |
|
|
|
err error |
|
|
|
) |
|
|
|
@@ -43,3 +44,34 @@ func GetModelArtsTask(ctx *context.APIContext) { |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func GetModelArtsTrainJob(ctx *context.APIContext) { |
|
|
|
var ( |
|
|
|
err error |
|
|
|
) |
|
|
|
|
|
|
|
jobID := ctx.Params(":jobid") |
|
|
|
repoID := ctx.Repo.Repository.ID |
|
|
|
job, err := models.GetRepoCloudBrainByJobID(repoID, jobID) |
|
|
|
if err != nil { |
|
|
|
ctx.NotFound(err) |
|
|
|
return |
|
|
|
} |
|
|
|
result, err := modelarts.GetTrainJob(jobID, strconv.FormatInt(job.VersionID, 10)) |
|
|
|
if err != nil { |
|
|
|
ctx.NotFound(err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
job.Status = modelarts.TransTrainJobStatus(result.IntStatus) |
|
|
|
err = models.UpdateJob(job) |
|
|
|
if err != nil { |
|
|
|
log.Error("UpdateJob failed:", err) |
|
|
|
} |
|
|
|
|
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
"JobID": jobID, |
|
|
|
"JobStatus": job.Status, |
|
|
|
}) |
|
|
|
|
|
|
|
} |