|
|
@@ -99,6 +99,18 @@ func saveModelByParameters(jobId string, versionName string, name string, versio |
|
|
|
//udpate status and version count |
|
|
|
models.ModifyModelNewProperty(lastNewModelId, MODEL_NOT_LATEST, 0) |
|
|
|
} |
|
|
|
var units []models.RepoUnit |
|
|
|
var deleteUnitTypes []models.UnitType |
|
|
|
units = append(units, models.RepoUnit{ |
|
|
|
RepoID: ctx.Repo.Repository.ID, |
|
|
|
Type: models.UnitTypeModelManage, |
|
|
|
Config: &models.ModelManageConfig{ |
|
|
|
EnableModelManage: true, |
|
|
|
}, |
|
|
|
}) |
|
|
|
deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeModelManage) |
|
|
|
|
|
|
|
models.UpdateRepositoryUnits(ctx.Repo.Repository, units, deleteUnitTypes) |
|
|
|
|
|
|
|
log.Info("save model end.") |
|
|
|
|
|
|
@@ -130,10 +142,13 @@ func SaveModel(ctx *context.Context) { |
|
|
|
version := ctx.Query("Version") |
|
|
|
label := ctx.Query("Label") |
|
|
|
description := ctx.Query("Description") |
|
|
|
trainTaskCreate := ctx.QueryBool("trainTaskCreate") |
|
|
|
|
|
|
|
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { |
|
|
|
ctx.ServerError("No right.", errors.New(ctx.Tr("repo.model_noright"))) |
|
|
|
return |
|
|
|
if !trainTaskCreate { |
|
|
|
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { |
|
|
|
ctx.ServerError("No right.", errors.New(ctx.Tr("repo.model_noright"))) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if JobId == "" || VersionName == "" { |
|
|
|