You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

listdatasetlogic.go 1.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package ai
  2. import (
  3. "context"
  4. "github.com/jinzhu/copier"
  5. "github.com/pkg/errors"
  6. "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts"
  7. "gitlink.org.cn/jcce-pcm/utils/result"
  8. "gitlink.org.cn/jcce-pcm/utils/tool"
  9. "gitlink.org.cn/jcce-pcm/utils/xerr"
  10. "k8s.io/apimachinery/pkg/util/json"
  11. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  12. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  13. "github.com/zeromicro/go-zero/core/logx"
  14. )
  15. type ListDataSetLogic struct {
  16. logx.Logger
  17. ctx context.Context
  18. svcCtx *svc.ServiceContext
  19. }
  20. func NewListDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDataSetLogic {
  21. return &ListDataSetLogic{
  22. Logger: logx.WithContext(ctx),
  23. ctx: ctx,
  24. svcCtx: svcCtx,
  25. }
  26. }
  27. func (l *ListDataSetLogic) ListDataSet(req *types.DataSetReq) (resp *types.DataSetResp, err error) {
  28. // todo: add your logic here and delete this line
  29. modelartsReq := &modelarts.DataSetReq{}
  30. err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: tool.Converters})
  31. //err = copier.CopyWithOption(modelartsReq, req, copier.Option{IgnoreEmpty: true, DeepCopy: true, Converters: tool.Converters})
  32. DataSetResp, err := l.svcCtx.ModelArtsRpc.GetDatasetList(l.ctx, modelartsReq)
  33. if err != nil {
  34. return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db DataSet list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req)
  35. }
  36. marshal, err := json.Marshal(&DataSetResp)
  37. if err != nil {
  38. return nil, result.NewDefaultError(err.Error())
  39. }
  40. json.Unmarshal(marshal, &resp)
  41. err = copier.CopyWithOption(&resp, &DataSetResp, copier.Option{Converters: tool.Converters})
  42. return resp, nil
  43. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.