package ai import ( "context" "github.com/jinzhu/copier" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" error2 "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/error" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts" "k8s.io/apimachinery/pkg/util/json" "github.com/zeromicro/go-zero/core/logx" ) type CreateTrainingJobLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewCreateTrainingJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTrainingJobLogic { return &CreateTrainingJobLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *CreateTrainingJobLogic) CreateTrainingJob(req *types.CreateTrainingJobReq) (resp *types.CreateTrainingJobResp, err error) { // todo: add your logic here and delete this line //modelartsType := req.ModelartsType modelartsReq := &modelarts.CreateTrainingJobReq{} err = copier.CopyWithOption(modelartsReq, req, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: utils.Converters}) CreateTrainingJobResp, err := l.svcCtx.ModelArtsRpc.CreateTrainingJob(l.ctx, modelartsReq) if err != nil { return nil, error2.NewDefaultError(err.Error()) } marshal, err := json.Marshal(&CreateTrainingJobResp) if err != nil { return nil, error2.NewDefaultError(err.Error()) } json.Unmarshal(marshal, &resp) err = copier.CopyWithOption(&resp, &CreateTrainingJobResp, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: utils.Converters}) return resp, nil }