From 2d0913850990a56f7997ab30dd7b8c4b899c5324 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 7 Apr 2021 09:20:42 +0800 Subject: [PATCH] add default param --- modules/modelarts/modelarts.go | 2 ++ routers/repo/modelarts.go | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index 51777d4f1..2d00bd0fd 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -45,6 +45,8 @@ const ( JobPath = "/job/" OrderDesc = "desc" OrderAsc = "asc" + TrainUrl = "train_url" + DataUrl = "data_url" ) type GenerateTrainJobReq struct { diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index bce55bd5b..b7f4da3a9 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -388,6 +388,13 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) var parameters models.Parameters param := make([]models.Parameter, 0) + param = append(param, models.Parameter{ + Label: modelarts.TrainUrl, + Value: outputObsPath, + }, models.Parameter{ + Label: modelarts.DataUrl, + Value: dataPath, + }) if len(params) != 0 { err := json.Unmarshal([]byte(params), ¶meters) if err != nil { @@ -397,10 +404,12 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) } for _, parameter := range parameters.Parameter { - param = append(param, models.Parameter{ - Label: parameter.Label, - Value: parameter.Value, - }) + if parameter.Label != modelarts.TrainUrl && parameter.Label != modelarts.DataUrl { + param = append(param, models.Parameter{ + Label: parameter.Label, + Value: parameter.Value, + }) + } } }