Merge branch '2.0' of https://gitlink.org.cn/JCCE/PCM into 2.0
Former-commit-id: 9473ef1ab2428dc2bb40f104abfa49119f150d93
This commit is contained in:
commit
e4ed584fee
|
@ -40,6 +40,9 @@ func generateTokenMap() map[string]TokenTimePair {
|
|||
}
|
||||
for k, v := range urlMap {
|
||||
token, expiredAt := generateToken(jsonStr, v)
|
||||
if token == "" {
|
||||
continue
|
||||
}
|
||||
tokenTimePair := TokenTimePair{
|
||||
Token: token,
|
||||
ExpiredAt: expiredAt,
|
||||
|
@ -67,18 +70,21 @@ func generateToken(jsonStr []byte, tokenUrl string) (string, time.Time) {
|
|||
func GetToken(kForToken string) string {
|
||||
|
||||
if tokenMap[kForToken].Token == "" {
|
||||
tokenMap = generateTokenMap()
|
||||
return ""
|
||||
}
|
||||
|
||||
tokenTimePair := tokenMap[kForToken]
|
||||
|
||||
if tokenTimePair.Token == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
if time.Now().After(tokenTimePair.ExpiredAt) {
|
||||
tokenMap = generateTokenMap()
|
||||
|
||||
if tokenMap[kForToken].Token == "" {
|
||||
return ""
|
||||
} else {
|
||||
return tokenMap[kForToken].Token
|
||||
}
|
||||
}
|
||||
|
||||
return tokenTimePair.Token
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"log"
|
||||
)
|
||||
|
||||
type CreateDataSetLogic struct {
|
||||
|
@ -30,6 +32,10 @@ func (l *CreateDataSetLogic) CreateDataSet(in *octopus.CreateDataSetReq) (*octop
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateDataSet
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *CreateDataSetVersionLogic) CreateDataSetVersion(in *octopus.CreateDataS
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateDataSetVersion
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -31,6 +33,10 @@ func (l *CreateImageLogic) CreateImage(in *octopus.CreateImageReq) (*octopus.Cre
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateImage
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -33,6 +35,10 @@ func (l *CreateModelDeployLogic) CreateModelDeploy(in *octopus.CreateModelDeploy
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateModelDeploy
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *CreateMyAlgorithmLogic) CreateMyAlgorithm(in *octopus.CreateMyAlgorithm
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateMyAlgorithm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *CreateNotebookLogic) CreateNotebook(in *octopus.CreateNotebookReq) (*oc
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateNotebook
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -33,6 +35,10 @@ func (l *CreateTrainJobLogic) CreateTrainJob(in *octopus.CreateTrainJobReq) (*oc
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.CreateTrainJob
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteDataSetLogic) DeleteDataSet(in *octopus.DeleteDataSetReq) (*octop
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteDataSet
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteDataSetVersionLogic) DeleteDataSetVersion(in *octopus.DeleteDataS
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteDataSetVersion
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteImageLogic) DeleteImage(in *octopus.DeleteImageReq) (*octopus.Del
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteImage
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteModelDeployLogic) DeleteModelDeploy(in *octopus.DeleteModelDeploy
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteModelDeploy
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
var queryStr string
|
||||
for _, s := range in.GetJobIds() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -31,6 +33,10 @@ func (l *DeleteModelVersionLogic) DeleteModelVersion(in *octopus.DeleteModelVers
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteModelVersion
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteMyAlgorithmLogic) DeleteMyAlgorithm(in *octopus.DeleteMyAlgorithm
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteMyAlgorithm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteMyModelLogic) DeleteMyModel(in *octopus.DeleteMyModelReq) (*octop
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteMyModel
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DeleteNotebookLogic) DeleteNotebook(in *octopus.DeleteNotebookReq) (*oc
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteNotebook
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,11 @@ func (l *DeleteTrainJobLogic) DeleteTrainJob(in *octopus.DeleteTrainJobReq) (*oc
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteTrainJob
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
|
||||
var queryStr string
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *DownloadAlgorithmLogic) DownloadAlgorithm(in *octopus.DownloadAlgorithm
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DownloadAlgorithm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -31,6 +33,10 @@ func (l *DownloadModelVersionLogic) DownloadModelVersion(in *octopus.DownloadMod
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DownloadModelVersion
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetAlgorithmApplyListLogic) GetAlgorithmApplyList(in *octopus.GetAlgori
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetAlgorithmApplyList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetAlgorithmFrameworkListLogic) GetAlgorithmFrameworkList(in *octopus.G
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetAlgorithmFrameworkList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetAlgorithmListLogic) GetAlgorithmList(in *octopus.GetAlgorithmListReq
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetAlgorithmList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *GetAlgorithmLogic) GetAlgorithm(in *octopus.GetAlgorithmReq) (*octopus.
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetAlgorithm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -70,6 +70,9 @@ func getCPFromOctopus() float32 {
|
|||
var computingPowerInTops int32
|
||||
for k, v := range urlMap {
|
||||
token := common.GetToken(k)
|
||||
if token == "" {
|
||||
continue
|
||||
}
|
||||
body, err := common.OctopusHttpClient("GET", v, nil, token)
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetDatasetApplyListLogic) GetDatasetApplyList(in *octopus.GetDatasetApp
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetDatasetApplyList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetDatasetTypeListLogic) GetDatasetTypeList(in *octopus.GetDatasetTypeL
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetDatasetTypeList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetDatasetVersionListLogic) GetDatasetVersionList(in *octopus.GetDatase
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetDatasetVersionList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -89,6 +89,9 @@ func getGeneralInfoFromOctopus() (int32, int32) {
|
|||
var memoryInGib int32
|
||||
for k, v := range urlMap {
|
||||
token := common.GetToken(k)
|
||||
if token == "" {
|
||||
continue
|
||||
}
|
||||
body, err := common.OctopusHttpClient("GET", v, nil, token)
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetModelDeployEventLogic) GetModelDeployEvent(in *octopus.GetModelDeplo
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetModelDeployEvent
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetModelDeployListLogic) GetModelDeployList(in *octopus.GetModelDeployL
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetModelDeployList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -31,6 +33,10 @@ func (l *GetModelDeployLogic) GetModelDeploy(in *octopus.GetModelDeployReq) (*oc
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetModelDeploy
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetModelVersionListLogic) GetModelVersionList(in *octopus.GetModelVersi
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetModelVersionList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -34,6 +36,10 @@ func (l *GetMyAlgorithmListLogic) GetMyAlgorithmList(in *octopus.GetMyAlgorithmL
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMyAlgorithmList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -34,6 +36,10 @@ func (l *GetMyDatasetListLogic) GetMyDatasetList(in *octopus.GetMyDatasetListReq
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMydatasetList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -34,6 +36,10 @@ func (l *GetMyModelListLogic) GetMyModelList(in *octopus.GetMyModelListReq) (*oc
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMyModelList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -34,6 +36,10 @@ func (l *GetNotebookListLogic) GetNotebookList(in *octopus.GetNotebookListReq) (
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetNotebookList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *GetNotebookLogic) GetNotebook(in *octopus.GetNotebookReq) (*octopus.Get
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetNotebook
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetTrainJobEventLogic) GetTrainJobEvent(in *octopus.GetTrainJobEventReq
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJobEvent
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetTrainJobListLogic) GetTrainJobList(in *octopus.GetTrainJobListReq) (
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJobList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -31,6 +33,10 @@ func (l *GetTrainJobLogic) GetTrainJob(in *octopus.GetTrainJobReq) (*octopus.Get
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJob
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetTrainJobMetricLogic) GetTrainJobMetric(in *octopus.GetTrainJobMetric
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJobMetric
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
@ -33,6 +35,10 @@ func (l *GetUserImageListLogic) GetUserImageList(in *octopus.GetUserImageListReq
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetUserImageList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *InferModelDeployLogic) InferModelDeploy(in *octopus.InferModelDeployReq
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.InferModelDeploy
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *StartNotebookLogic) StartNotebook(in *octopus.StartNotebookReq) (*octop
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.StartNotebook
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *StopModelDeployLogic) StopModelDeploy(in *octopus.StopModelDeployReq) (
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.StopModelDeploy
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *StopNotebookLogic) StopNotebook(in *octopus.StopNotebookReq) (*octopus.
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.StopNotebook
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *StopTrainJobLogic) StopTrainJob(in *octopus.StopTrainJobReq) (*octopus.
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.StopTrainJob
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *UploadAlgorithmConfirmLogic) UploadAlgorithmConfirm(in *octopus.UploadA
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.UploadAlgorithmConfirm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *UploadAlgorithmLogic) UploadAlgorithm(in *octopus.UploadAlgorithmReq) (
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.UploadAlgorithm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *UploadDataSetConfirmLogic) UploadDataSetConfirm(in *octopus.UploadDataS
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.UploadDataSetConfirm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *UploadDataSetLogic) UploadDataSet(in *octopus.UploadDataSetReq) (*octop
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.UploadDataSet
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *UploadImageConfirmLogic) UploadImageConfirm(in *octopus.UploadImageConf
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.UploadImageConfirm
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
@ -32,6 +34,10 @@ func (l *UploadImageLogic) UploadImage(in *octopus.UploadImageReq) (*octopus.Upl
|
|||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.UploadImage
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
if token == "" {
|
||||
log.Println("获取token失败, platform : ", in.Platform)
|
||||
return nil, errors.New("获取token失败")
|
||||
}
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
|
|
|
@ -2,7 +2,7 @@ FROM alpine:3.16.2
|
|||
WORKDIR /home
|
||||
|
||||
# 修改alpine源为上海交通大学
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache ca-certificates && update-ca-certificates && \
|
||||
|
|
|
@ -39,4 +39,9 @@ type Config struct {
|
|||
AccessKey string
|
||||
Endpoint string
|
||||
}
|
||||
|
||||
RegistryConf struct {
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package image
|
|||
import (
|
||||
"PCM/adaptor/PCM-CORE/model"
|
||||
result2 "PCM/common/result"
|
||||
"PCM/common/tool"
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
|
@ -10,6 +11,7 @@ import (
|
|||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
||||
types2 "github.com/docker/docker/api/types"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"io/ioutil"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"net/http"
|
||||
|
@ -18,6 +20,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
)
|
||||
|
@ -31,8 +34,14 @@ func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
hash := r.PostFormValue("hash")
|
||||
name := r.PostFormValue("name")
|
||||
dataType := r.PostFormValue("dataType")
|
||||
kind := r.PostFormValue("kind")
|
||||
// 对比合并请求的文件大小和已上传文件夹大小
|
||||
toSize, _ := getDirSize(filepath.Join(uploadTempPath, hash))
|
||||
toSize, err := tool.GetDirSize(filepath.Join(uploadTempPath, hash))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
result2.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
if size != toSize {
|
||||
fmt.Fprintf(w, "文件上传错误")
|
||||
}
|
||||
|
@ -45,11 +54,11 @@ func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
filesSort[nameArr[1]] = f.Name()
|
||||
}
|
||||
saveFile := filepath.Join(uploadPath, name)
|
||||
if exists, _ := PathExists(saveFile); exists {
|
||||
if exists, _ := tool.PathExists(saveFile); exists {
|
||||
os.Remove(saveFile)
|
||||
}
|
||||
fs, _ := os.OpenFile(saveFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, os.ModeAppend|os.ModePerm)
|
||||
defer fs.Close()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
filesCount := len(files)
|
||||
if filesCount != len(filesSort) {
|
||||
|
@ -62,7 +71,6 @@ func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
data, err := ioutil.ReadFile(fileName)
|
||||
fmt.Println(err)
|
||||
fs.Write(data)
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
wg.Wait()
|
||||
|
@ -70,95 +78,117 @@ func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
|
||||
// 保存到数据库表里
|
||||
svcCtx.DbEngin.Create(&model.File{
|
||||
Name: name,
|
||||
Hash: hash,
|
||||
Type: dataType,
|
||||
Status: "0",
|
||||
Bucket: "pcm"})
|
||||
Name: name,
|
||||
Hash: hash,
|
||||
DataType: dataType,
|
||||
Status: "local",
|
||||
Kind: kind,
|
||||
Bucket: "pcm"})
|
||||
|
||||
// 根据数据类型按需上传(镜像推送到nexus 数据集和算法推送到云际存储)
|
||||
switch dataType {
|
||||
switch kind {
|
||||
case "image":
|
||||
pushImage(svcCtx, name)
|
||||
err = pushImage(svcCtx, hash, name)
|
||||
case "dataSet", "algorithm":
|
||||
uploadStorage(svcCtx, name)
|
||||
}
|
||||
|
||||
err := pushImage(svcCtx, name)
|
||||
if err != nil {
|
||||
result2.HttpResult(r, w, nil, err)
|
||||
return
|
||||
err = uploadStorage(svcCtx, hash, name)
|
||||
}
|
||||
// 删除本地文件 避免占用本地存储资源
|
||||
err = os.Remove(filepath.Join(uploadPath, name))
|
||||
defer os.Remove(filepath.Join(uploadPath, name))
|
||||
defer fs.Close()
|
||||
result2.HttpResult(r, w, nil, err)
|
||||
}
|
||||
}
|
||||
|
||||
func uploadStorage(svcCtx *svc.ServiceContext, name string) error {
|
||||
svcCtx.Uploader.Upload(&s3manager.UploadInput{
|
||||
// 同步数据集到modelArts
|
||||
func syncDataSet() {
|
||||
|
||||
}
|
||||
|
||||
// 上传文件到云集存储
|
||||
func uploadStorage(svcCtx *svc.ServiceContext, hash string, name string) error {
|
||||
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
_, err = svcCtx.Uploader.Upload(&s3manager.UploadInput{
|
||||
Bucket: aws.String("pcm"),
|
||||
Key: aws.String(name),
|
||||
Body: fileInfo,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
// 更新数据状态
|
||||
svcCtx.DbEngin.Model(&model.File{}).Where("hash = ?", hash).Update("status", "cloud")
|
||||
return nil
|
||||
}
|
||||
|
||||
func pushImage(svcCtx *svc.ServiceContext, name string) error {
|
||||
// 推送镜像到nexus仓库
|
||||
func pushImage(svcCtx *svc.ServiceContext, hash string, name string) error {
|
||||
// 加载镜像文件到docker
|
||||
fileInfo, err := os.Open(filepath.Join(uploadPath, name))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
defer fileInfo.Close()
|
||||
reader := bufio.NewReader(fileInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
body, err := svcCtx.DockerClient.ImageLoad(context.Background(), reader, false)
|
||||
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
|
||||
bytes, err := ioutil.ReadAll(body.Body)
|
||||
|
||||
loadBody := LoadBody{}
|
||||
err = json.Unmarshal(bytes, &loadBody)
|
||||
println(string(bytes))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
|
||||
imageName := strings.TrimSpace(loadBody.Stream[13:])
|
||||
privateImageName := "hub.jcce.dev:18445/" + imageName
|
||||
//time.Sleep(12 * 100 * time.Millisecond)
|
||||
privateImageName := "registry.cn-hangzhou.aliyuncs.com/jointcloud/pcm:" + name
|
||||
// 给镜像打上私有仓库的tag
|
||||
err = svcCtx.DockerClient.ImageTag(context.Background(), imageName, privateImageName)
|
||||
err = svcCtx.DockerClient.ImageTag(context.Background(), name, privateImageName)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
// 删除原镜像
|
||||
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), name, types2.ImageRemoveOptions{})
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
// 推送镜像到registry
|
||||
authConfig := types2.AuthConfig{
|
||||
Username: "admin",
|
||||
Password: "Nudt@123",
|
||||
Username: svcCtx.Config.RegistryConf.Username,
|
||||
Password: svcCtx.Config.RegistryConf.Password,
|
||||
}
|
||||
authConfigBytes, err := json.Marshal(authConfig)
|
||||
authStr := base64.URLEncoding.EncodeToString(authConfigBytes)
|
||||
_, err = svcCtx.DockerClient.ImagePush(context.Background(), privateImageName, types2.ImagePushOptions{RegistryAuth: authStr})
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
println("传输完成!")
|
||||
logx.Infof(fmt.Sprintln("传输开始", time.Now()))
|
||||
authStr := base64.URLEncoding.EncodeToString(authConfigBytes)
|
||||
pushBody, err := svcCtx.DockerClient.ImagePush(context.Background(), privateImageName, types2.ImagePushOptions{RegistryAuth: authStr})
|
||||
pushBytes, _ := ioutil.ReadAll(pushBody)
|
||||
println(string(pushBytes))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
logx.Infof(fmt.Sprintln("传输完成", time.Now()))
|
||||
// 删除本地镜像 避免存储资源浪费
|
||||
_, err = svcCtx.DockerClient.ImageRemove(context.Background(), privateImageName, types2.ImageRemoveOptions{})
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return err
|
||||
}
|
||||
// 更新数据状态
|
||||
svcCtx.DbEngin.Model(&model.File{}).Where("hash = ?", hash).Update("status", "cloud")
|
||||
return nil
|
||||
}
|
||||
|
||||
// DirSize 获取整体文件夹大小
|
||||
func getDirSize(path string) (int64, error) {
|
||||
var size int64
|
||||
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||
if !info.IsDir() {
|
||||
size += info.Size()
|
||||
}
|
||||
return err
|
||||
})
|
||||
return size, err
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ package image
|
|||
|
||||
import (
|
||||
result2 "PCM/common/result"
|
||||
"PCM/common/tool"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -23,6 +25,11 @@ var uploadTempPath = filepath.Join(uploadPath, "temp")
|
|||
func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
file, fileHeader, err := r.FormFile("file")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
result2.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
index := r.PostFormValue("index")
|
||||
hash := r.PostFormValue("hash")
|
||||
|
||||
|
@ -32,12 +39,22 @@ func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
// 文件路径
|
||||
filePath := filepath.Join(chunksPath, hash+"-"+index)
|
||||
// 检查临时文件夹是否存在 不存在则创建文件夹
|
||||
isPathExists, err := PathExists(chunksPath)
|
||||
isPathExists, err := tool.PathExists(chunksPath)
|
||||
if !isPathExists {
|
||||
err = os.MkdirAll(chunksPath, os.ModePerm)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
result2.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
// 检查文件是否存在
|
||||
exists, err := PathExists(filePath)
|
||||
exists, err := tool.PathExists(filePath)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
result2.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
// 文件存在 进行断点续传
|
||||
if exists {
|
||||
fileInfo, _ := os.Stat(filePath)
|
||||
|
@ -86,15 +103,3 @@ func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result2.HttpResult(r, w, nil, err)
|
||||
}
|
||||
}
|
||||
|
||||
// PathExists 判断文件夹是否存在
|
||||
func PathExists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true, nil
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -25,25 +25,70 @@ func NewGetComputingPowerLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
}
|
||||
}
|
||||
|
||||
func (l *GetComputingPowerLogic) GetComputingPower() (resp *types.CpResp, err error) {
|
||||
type client struct {
|
||||
}
|
||||
|
||||
apiResp := types.CpResp{}
|
||||
func (c *client) getComputingPower(cp computingPower, l *GetComputingPowerLogic) float32 {
|
||||
return cp.GetComputing(l)
|
||||
}
|
||||
|
||||
//启智章鱼资源算力
|
||||
type OctopusComputingPower struct {
|
||||
}
|
||||
|
||||
type AcComputingPower struct {
|
||||
}
|
||||
|
||||
type computingPower interface {
|
||||
GetComputing(l *GetComputingPowerLogic) float32
|
||||
}
|
||||
|
||||
// 启智章鱼资源算力
|
||||
func (cp OctopusComputingPower) GetComputing(l *GetComputingPowerLogic) float32 {
|
||||
octopusCpReq := &octopus.ResourceReq{}
|
||||
octopusCpResp, err := l.svcCtx.OctopusRpc.GetComputingPower(l.ctx, octopusCpReq)
|
||||
if err != nil {
|
||||
log.Println("OctopusRpc 算力请求失败", err)
|
||||
}
|
||||
return octopusCpResp.POpsAtFp16
|
||||
}
|
||||
|
||||
//曙光账号算力
|
||||
// 曙光账号算力
|
||||
func (cp AcComputingPower) GetComputing(l *GetComputingPowerLogic) float32 {
|
||||
acCpReq := &hpcAC.ResourceReq{}
|
||||
acCpResp, err := l.svcCtx.ACRpc.GetComputingPower(l.ctx, acCpReq)
|
||||
if err != nil {
|
||||
log.Println("ACRpc 算力请求失败", err)
|
||||
}
|
||||
return acCpResp.POpsAtFp16
|
||||
}
|
||||
|
||||
func (l *GetComputingPowerLogic) GetComputingPower() (resp *types.CpResp, err error) {
|
||||
|
||||
apiResp := types.CpResp{}
|
||||
|
||||
c := client{}
|
||||
ot := OctopusComputingPower{}
|
||||
ac := AcComputingPower{}
|
||||
a := c.getComputingPower(ot, l)
|
||||
b := c.getComputingPower(ac, l)
|
||||
|
||||
apiResp.POpsAtFp16 = a + b
|
||||
////启智章鱼资源算力
|
||||
//octopusCpReq := &octopus.ResourceReq{}
|
||||
//octopusCpResp, err := l.svcCtx.OctopusRpc.GetComputingPower(l.ctx, octopusCpReq)
|
||||
//if err != nil {
|
||||
// log.Println("OctopusRpc 算力请求失败", err)
|
||||
//}
|
||||
//
|
||||
////曙光账号算力
|
||||
//acCpReq := &hpcAC.ResourceReq{}
|
||||
//acCpResp, err := l.svcCtx.ACRpc.GetComputingPower(l.ctx, acCpReq)
|
||||
//if err != nil {
|
||||
// log.Println("ACRpc 算力请求失败", err)
|
||||
//}
|
||||
//
|
||||
//computingPowerAggregated := acCpResp.POpsAtFp16 + octopusCpResp.POpsAtFp16
|
||||
//apiResp.POpsAtFp16 = computingPowerAggregated
|
||||
|
||||
computingPowerAggregated := acCpResp.POpsAtFp16 + octopusCpResp.POpsAtFp16
|
||||
apiResp.POpsAtFp16 = computingPowerAggregated
|
||||
return &apiResp, nil
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ func (l *JobTotalLogic) JobTotal() (resp *types.JobTotalResp, err error) {
|
|||
for _, job := range jobs.OtJobs {
|
||||
trainJob := types.TrainJob{
|
||||
Name: job.Name,
|
||||
Status: job.Status,
|
||||
Status: enum.ExternalStatus(job.Status).String(),
|
||||
Strategy: 0,
|
||||
SynergyStatus: "未协同",
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package image
|
|||
import (
|
||||
"PCM/adaptor/PCM-CORE/api/internal/svc"
|
||||
"PCM/adaptor/PCM-CORE/api/internal/types"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
|
@ -30,31 +27,12 @@ func NewImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ImageLi
|
|||
}
|
||||
|
||||
func (l *ImageListLogic) ImageList() (resp *types.ImageListResp, err error) {
|
||||
var images []string
|
||||
l.svcCtx.DbEngin.Raw("select distinct name from file where kind = 'image'").Scan(&images)
|
||||
|
||||
// 获取镜像列表
|
||||
url := fmt.Sprintf("%s/repository/%s/v2/_catalog", l.svcCtx.Config.NexusUrl, "pcm")
|
||||
bytes, err := tool.HttpClient("GET", url, nil, "")
|
||||
json.Unmarshal(bytes, &resp)
|
||||
result := types.ImageListResp{}
|
||||
for _, image := range resp.Repositories {
|
||||
// 获取镜像的tag列表
|
||||
url := fmt.Sprintf("%s/repository/%s/v2/%s/tags/list", l.svcCtx.Config.NexusUrl, "pcm", image)
|
||||
bytes, err := tool.HttpClient("GET", url, nil, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tags := ImageTags{}
|
||||
json.Unmarshal(bytes, &tags)
|
||||
// 拼接镜像名称
|
||||
for _, tag := range tags.Tags {
|
||||
var name string
|
||||
if tag != "latest" {
|
||||
name = "hub.jcce.dev:18445/" + image + ":" + tag
|
||||
} else {
|
||||
name = "hub.jcce.dev:18445/" + image
|
||||
}
|
||||
result.Repositories = append(result.Repositories, name)
|
||||
}
|
||||
result := types.ImageListResp{
|
||||
Repositories: images,
|
||||
}
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
|
|
@ -13,14 +13,14 @@ import "time"
|
|||
// class:HongMouer.HIS.Models.DataSet
|
||||
// version:2023-05-06 09:58
|
||||
type File struct {
|
||||
Id *int `gorm:"column:id" json:"Id"` //type:*int comment:id version:2023-05-06 09:58
|
||||
Name string `gorm:"column:name" json:"Name"` //type:string comment:文件名称 version:2023-05-06 09:58
|
||||
Type string `gorm:"column:type" json:"Type"` //type:string comment: version:2023-05-06 09:58
|
||||
Id *int `gorm:"column:id" json:"Id"` //type:*int comment:id version:2023-05-06 09:58
|
||||
Name string `gorm:"column:name" json:"Name"` //type:string comment:文件名称 version:2023-05-06 09:58
|
||||
Kind string `gorm:"column:kind" json:"Kind"`
|
||||
DataType string `gorm:"column:data_type" json:"dataType"` //type:string comment: version:2023-05-06 09:58
|
||||
Suffix string `gorm:"column:suffix" json:"Suffix"` //type:string comment:后缀名 version:2023-05-06 09:58
|
||||
Bucket string `gorm:"column:bucket" json:"Bucket"` //type:string comment:桶 version:2023-05-06 09:58
|
||||
Hash string `gorm:"column:hash" json:"Hash"` //type:string comment:hash version:2023-05-06 09:58
|
||||
Status string `gorm:"column:status" json:"Status"` //type:string comment:hash version:2023-05-06 09:58
|
||||
Size int64 `gorm:"column:size" json:"Size"` //type:*int comment:大小 version:2023-05-06 09:58
|
||||
DeletedFlag *int `gorm:"column:deleted_flag" json:"DeletedFlag"` //type:*int comment:是否删除 version:2023-05-06 09:58
|
||||
CreatedBy *int `gorm:"column:created_by" json:"CreatedBy"` //type:*int comment:创建人 version:2023-05-06 09:58
|
||||
CreatedTime *time.Time `gorm:"column:created_time" json:"CreatedTime"` //type:*time.Time comment:创建时间 version:2023-05-06 09:58
|
||||
|
|
|
@ -2,11 +2,21 @@
|
|||
|
||||
### 腾讯云SCF 常用的 API 如下,更多 API 可参考 [API 文档](https://cloud.tencent.com/document/product/583/17234)
|
||||
|
||||
| 接口名称 | 接口功能 |
|
||||
| ------------------------------------------------------------ | ---------------- |
|
||||
| [CreateFunction](https://cloud.tencent.com/document/api/583/18586) | 创建函数 |
|
||||
| [DeleteFunction](https://cloud.tencent.com/document/api/583/18585) | 删除函数 |
|
||||
| [GetFunction](https://cloud.tencent.com/document/api/583/18584) | 获取函数详细信息 |
|
||||
| [Invoke](https://cloud.tencent.com/document/api/583/17243) | 运行函数 |
|
||||
| [ListFunctions](https://cloud.tencent.com/document/api/583/18582) | 获取函数列表 |
|
||||
| [UpdateFunctionCode](https://cloud.tencent.com/document/api/583/18581) | 更新函数代码 |
|
||||
| [UpdateFunctionConfiguration](https://cloud.tencent.com/document/api/583/18580) | 更新函数配置 |
|
||||
|
||||
> 接口对接进度
|
||||
|
||||
- [ ] CreateFunction 创建函数
|
||||
- [ ] DeleteFunction 删除函数
|
||||
- [ ] GetFunction 获取函数详细信息
|
||||
- [x] GetFunction 获取函数详细信息
|
||||
- [ ] Invoke 运行函数
|
||||
- [x] ListFunctions 获取函数列表
|
||||
- [ ] UpdateFunctionCode 更新函数代码
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
|
||||
tscf "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416"
|
||||
|
||||
"PCM/adaptor/PCM-FC/PCM-SCF/internal/svc"
|
||||
"PCM/adaptor/PCM-FC/PCM-SCF/scf"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetFunctionsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetFunctionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFunctionsLogic {
|
||||
return &GetFunctionsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// GetFunctions 查询腾讯云云函数详情
|
||||
func (l *GetFunctionsLogic) GetFunctions(in *scf.GetFunctionsReq) (*scf.GetFunctionsResp, error) {
|
||||
resp := &scf.GetFunctionsResp{}
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的k
|
||||
client, _ := tscf.NewClient(l.svcCtx.Credential, in.Region, l.svcCtx.Cpf)
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
request := tscf.NewGetFunctionRequest()
|
||||
|
||||
request.FunctionName = common.StringPtr(in.FunctionName)
|
||||
|
||||
// 返回的resp是一个GetFunctionResponse的实例,与请求对象对应
|
||||
response, err := client.GetFunction(request)
|
||||
if _, ok := err.(*errors.TencentCloudSDKError); ok {
|
||||
fmt.Printf("An API error has returned: %s", err)
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
tool.Convert(response.Response, &resp.Response)
|
||||
return resp, nil
|
||||
}
|
|
@ -7,7 +7,6 @@ import (
|
|||
"context"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
|
||||
tscf "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -26,15 +25,11 @@ func NewListFunctionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Lis
|
|||
}
|
||||
}
|
||||
|
||||
// 查询腾讯云云函数列表
|
||||
// ListFunctions 查询腾讯云云函数列表
|
||||
func (l *ListFunctionsLogic) ListFunctions(in *scf.ListFunctionsReq) (*scf.ListFunctionsResp, error) {
|
||||
resp := &scf.ListFunctionsResp{}
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
cpf := profile.NewClientProfile()
|
||||
//请求域名,表示用户的接入地域,默认就近接入
|
||||
cpf.HttpProfile.Endpoint = "scf.tencentcloudapi.com"
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
client, _ := tscf.NewClient(l.svcCtx.Credential, in.Region, cpf)
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的k
|
||||
client, _ := tscf.NewClient(l.svcCtx.Credential, in.Region, l.svcCtx.Cpf)
|
||||
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
request := tscf.NewListFunctionsRequest()
|
||||
|
|
|
@ -22,8 +22,14 @@ func NewScfServer(svcCtx *svc.ServiceContext) *ScfServer {
|
|||
}
|
||||
}
|
||||
|
||||
// 查询腾讯云云函数列表
|
||||
// ListFunctions 查询腾讯云云函数列表
|
||||
func (s *ScfServer) ListFunctions(ctx context.Context, in *scf.ListFunctionsReq) (*scf.ListFunctionsResp, error) {
|
||||
l := logic.NewListFunctionsLogic(ctx, s.svcCtx)
|
||||
return l.ListFunctions(in)
|
||||
}
|
||||
|
||||
// GetFunctions 查询腾讯云云函数详情
|
||||
func (s *ScfServer) GetFunctions(ctx context.Context, in *scf.GetFunctionsReq) (*scf.GetFunctionsResp, error) {
|
||||
l := logic.NewGetFunctionsLogic(ctx, s.svcCtx)
|
||||
return l.GetFunctions(in)
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@ package svc
|
|||
import (
|
||||
"PCM/adaptor/PCM-FC/PCM-SCF/internal/config"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
Credential *common.Credential
|
||||
Cpf *profile.ClientProfile
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
|
@ -17,8 +19,14 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
|||
c.SecretConfig.SecretKey,
|
||||
)
|
||||
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
cpf := profile.NewClientProfile()
|
||||
//请求域名,表示用户的接入地域,默认就近接入
|
||||
cpf.HttpProfile.Endpoint = "scf.tencentcloudapi.com"
|
||||
|
||||
return &ServiceContext{
|
||||
Credential: credential,
|
||||
Config: c,
|
||||
Cpf: cpf,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,167 @@ syntax = "proto3";
|
|||
package scf;
|
||||
option go_package = "/scf";
|
||||
|
||||
message GetFunctionsReq {
|
||||
string functionName = 1;
|
||||
string qualifier = 2;
|
||||
string namespace = 3;
|
||||
string showCode = 4;
|
||||
string region = 5;
|
||||
}
|
||||
|
||||
message Triggers {
|
||||
string ModTime = 1;
|
||||
string Type = 2;
|
||||
string TriggerDesc = 3;
|
||||
string TriggerName = 4;
|
||||
string AddTime = 5;
|
||||
uint32 Enable = 6;
|
||||
string CustomArgument = 7;
|
||||
string AvailableStatus = 8;
|
||||
string ResourceId = 9;
|
||||
string BindStatus = 10;
|
||||
string TriggerAttribute = 11;
|
||||
string Qualifier = 12;
|
||||
string Description = 13;
|
||||
}
|
||||
|
||||
message Vpcconfig {
|
||||
string VpcId = 1;
|
||||
string SubnetId = 2;
|
||||
}
|
||||
|
||||
message Variables {
|
||||
string Key = 1;
|
||||
string Value = 2;
|
||||
}
|
||||
|
||||
message Environment {
|
||||
repeated Variables Variables = 1;
|
||||
}
|
||||
|
||||
message Tags {
|
||||
string Key = 1;
|
||||
string Value = 2;
|
||||
}
|
||||
|
||||
message Eipconfig {
|
||||
string EipFixed = 1;
|
||||
repeated string Eips = 2;
|
||||
}
|
||||
|
||||
message Accessinfo {
|
||||
string Host = 1;
|
||||
string Vip = 2;
|
||||
}
|
||||
|
||||
message Layers {
|
||||
repeated string CompatibleRuntimes = 1;
|
||||
string AddTime = 2;
|
||||
string Description = 3;
|
||||
string LicenseInfo = 4;
|
||||
uint32 LayerVersion = 5;
|
||||
string LayerName = 6;
|
||||
string Status = 7;
|
||||
string Stamp = 8;
|
||||
}
|
||||
|
||||
message Deadletterconfig {
|
||||
string Type = 1;
|
||||
string Name = 2;
|
||||
string FilterType = 3;
|
||||
}
|
||||
|
||||
message Eipconfig1 {
|
||||
string EipStatus = 1;
|
||||
repeated string EipAddress = 2;
|
||||
}
|
||||
|
||||
message Publicnetconfig {
|
||||
string PublicNetStatus = 1;
|
||||
Eipconfig1 EipConfig = 2;
|
||||
}
|
||||
|
||||
message Cfsinslist {
|
||||
string UserId = 1;
|
||||
string UserGroupId = 2;
|
||||
string CfsId = 3;
|
||||
string MountInsId = 4;
|
||||
string LocalMountDir = 5;
|
||||
string RemoteMountDir = 6;
|
||||
string IpAddress = 7;
|
||||
string MountVpcId = 8;
|
||||
string MountSubnetId = 9;
|
||||
}
|
||||
|
||||
message Cfsconfig {
|
||||
repeated Cfsinslist CfsInsList = 1;
|
||||
}
|
||||
|
||||
message Statusreasons {
|
||||
string ErrorCode = 1;
|
||||
string ErrorMessage = 2;
|
||||
}
|
||||
|
||||
message Wsparams {
|
||||
uint32 IdleTimeOut = 1;
|
||||
}
|
||||
|
||||
message Protocolparams {
|
||||
Wsparams WSParams = 1;
|
||||
}
|
||||
|
||||
message GetFunctionsResp {
|
||||
GetFunctionsResponse Response = 1;
|
||||
}
|
||||
|
||||
message GetFunctionsResponse {
|
||||
string ModTime = 1;
|
||||
string CodeInfo = 2;
|
||||
string Description = 3;
|
||||
repeated Triggers Triggers = 4;
|
||||
string Handler = 5;
|
||||
uint32 CodeSize = 6;
|
||||
uint32 Timeout = 7;
|
||||
string FunctionVersion = 8;
|
||||
uint32 MemorySize = 9;
|
||||
string Runtime = 10;
|
||||
string FunctionName = 11;
|
||||
Vpcconfig VpcConfig = 12;
|
||||
string UseGpu = 13;
|
||||
Environment Environment = 14;
|
||||
string CodeResult = 15;
|
||||
string CodeError = 16;
|
||||
uint32 ErrNo = 17;
|
||||
string Namespace = 18;
|
||||
string Role = 19;
|
||||
string InstallDependency = 20;
|
||||
string Status = 21;
|
||||
string StatusDesc = 22;
|
||||
string ClsLogsetId = 23;
|
||||
string ClsTopicId = 24;
|
||||
string FunctionId = 25;
|
||||
repeated Tags Tags = 26;
|
||||
Eipconfig EipConfig = 27;
|
||||
Accessinfo AccessInfo = 28;
|
||||
string Type = 29;
|
||||
string L5Enable = 30;
|
||||
repeated Layers Layers = 31;
|
||||
Deadletterconfig DeadLetterConfig = 32;
|
||||
string AddTime = 33;
|
||||
Publicnetconfig PublicNetConfig = 34;
|
||||
string OnsEnable = 35;
|
||||
Cfsconfig CfsConfig = 36;
|
||||
string AvailableStatus = 37;
|
||||
string Qualifier = 38;
|
||||
uint32 InitTimeout = 39;
|
||||
repeated Statusreasons StatusReasons = 40;
|
||||
string AsyncRunEnable = 41;
|
||||
string TraceEnable = 42;
|
||||
string ProtocolType = 43;
|
||||
Protocolparams ProtocolParams = 44;
|
||||
string RequestId = 45;
|
||||
}
|
||||
|
||||
message ListFunctionsReq {
|
||||
string order = 1;
|
||||
string orderby = 2;
|
||||
|
@ -22,7 +183,7 @@ message Filters {
|
|||
|
||||
|
||||
message ListFunctionsResp {
|
||||
Response response = 1;
|
||||
ListFunctionsResponse Response = 1;
|
||||
}
|
||||
|
||||
message Functions {
|
||||
|
@ -44,17 +205,20 @@ message Functions {
|
|||
string type = 16;
|
||||
}
|
||||
|
||||
message Response {
|
||||
message ListFunctionsResponse {
|
||||
repeated Functions functions = 1;
|
||||
string requestId = 2;
|
||||
int32 totalCount = 3;
|
||||
}
|
||||
|
||||
|
||||
// scf
|
||||
// scf 腾讯云函数
|
||||
service Scf {
|
||||
|
||||
//查询腾讯云云函数列表
|
||||
//ListFunctions 查询腾讯云云函数列表
|
||||
rpc ListFunctions(ListFunctionsReq) returns (ListFunctionsResp);
|
||||
|
||||
//GetFunctions 查询腾讯云云函数详情
|
||||
rpc GetFunctions(GetFunctionsReq) returns (GetFunctionsResp);
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc v3.21.12
|
||||
// - protoc v4.23.4
|
||||
// source: pb/pcm-scf.proto
|
||||
|
||||
package scf
|
||||
|
@ -20,14 +20,17 @@ const _ = grpc.SupportPackageIsVersion7
|
|||
|
||||
const (
|
||||
Scf_ListFunctions_FullMethodName = "/scf.Scf/ListFunctions"
|
||||
Scf_GetFunctions_FullMethodName = "/scf.Scf/GetFunctions"
|
||||
)
|
||||
|
||||
// ScfClient is the client API for Scf service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ScfClient interface {
|
||||
// 查询腾讯云云函数列表
|
||||
// ListFunctions 查询腾讯云云函数列表
|
||||
ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error)
|
||||
// GetFunctions 查询腾讯云云函数详情
|
||||
GetFunctions(ctx context.Context, in *GetFunctionsReq, opts ...grpc.CallOption) (*GetFunctionsResp, error)
|
||||
}
|
||||
|
||||
type scfClient struct {
|
||||
|
@ -47,12 +50,23 @@ func (c *scfClient) ListFunctions(ctx context.Context, in *ListFunctionsReq, opt
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *scfClient) GetFunctions(ctx context.Context, in *GetFunctionsReq, opts ...grpc.CallOption) (*GetFunctionsResp, error) {
|
||||
out := new(GetFunctionsResp)
|
||||
err := c.cc.Invoke(ctx, Scf_GetFunctions_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ScfServer is the server API for Scf service.
|
||||
// All implementations must embed UnimplementedScfServer
|
||||
// for forward compatibility
|
||||
type ScfServer interface {
|
||||
// 查询腾讯云云函数列表
|
||||
// ListFunctions 查询腾讯云云函数列表
|
||||
ListFunctions(context.Context, *ListFunctionsReq) (*ListFunctionsResp, error)
|
||||
// GetFunctions 查询腾讯云云函数详情
|
||||
GetFunctions(context.Context, *GetFunctionsReq) (*GetFunctionsResp, error)
|
||||
mustEmbedUnimplementedScfServer()
|
||||
}
|
||||
|
||||
|
@ -63,6 +77,9 @@ type UnimplementedScfServer struct {
|
|||
func (UnimplementedScfServer) ListFunctions(context.Context, *ListFunctionsReq) (*ListFunctionsResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListFunctions not implemented")
|
||||
}
|
||||
func (UnimplementedScfServer) GetFunctions(context.Context, *GetFunctionsReq) (*GetFunctionsResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented")
|
||||
}
|
||||
func (UnimplementedScfServer) mustEmbedUnimplementedScfServer() {}
|
||||
|
||||
// UnsafeScfServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
@ -94,6 +111,24 @@ func _Scf_ListFunctions_Handler(srv interface{}, ctx context.Context, dec func(i
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Scf_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetFunctionsReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ScfServer).GetFunctions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Scf_GetFunctions_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ScfServer).GetFunctions(ctx, req.(*GetFunctionsReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Scf_ServiceDesc is the grpc.ServiceDesc for Scf service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -105,6 +140,10 @@ var Scf_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "ListFunctions",
|
||||
Handler: _Scf_ListFunctions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetFunctions",
|
||||
Handler: _Scf_GetFunctions_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pb/pcm-scf.proto",
|
||||
|
|
|
@ -13,15 +13,36 @@ import (
|
|||
)
|
||||
|
||||
type (
|
||||
Filters = scf.Filters
|
||||
Functions = scf.Functions
|
||||
ListFunctionsReq = scf.ListFunctionsReq
|
||||
ListFunctionsResp = scf.ListFunctionsResp
|
||||
Response = scf.Response
|
||||
Accessinfo = scf.Accessinfo
|
||||
Cfsconfig = scf.Cfsconfig
|
||||
Cfsinslist = scf.Cfsinslist
|
||||
Deadletterconfig = scf.Deadletterconfig
|
||||
Eipconfig = scf.Eipconfig
|
||||
Eipconfig1 = scf.Eipconfig1
|
||||
Environment = scf.Environment
|
||||
Filters = scf.Filters
|
||||
Functions = scf.Functions
|
||||
GetFunctionsReq = scf.GetFunctionsReq
|
||||
GetFunctionsResp = scf.GetFunctionsResp
|
||||
GetFunctionsResponse = scf.GetFunctionsResponse
|
||||
Layers = scf.Layers
|
||||
ListFunctionsReq = scf.ListFunctionsReq
|
||||
ListFunctionsResp = scf.ListFunctionsResp
|
||||
ListFunctionsResponse = scf.ListFunctionsResponse
|
||||
Protocolparams = scf.Protocolparams
|
||||
Publicnetconfig = scf.Publicnetconfig
|
||||
Statusreasons = scf.Statusreasons
|
||||
Tags = scf.Tags
|
||||
Triggers = scf.Triggers
|
||||
Variables = scf.Variables
|
||||
Vpcconfig = scf.Vpcconfig
|
||||
Wsparams = scf.Wsparams
|
||||
|
||||
Scf interface {
|
||||
// 查询腾讯云云函数列表
|
||||
// ListFunctions 查询腾讯云云函数列表
|
||||
ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error)
|
||||
// GetFunctions 查询腾讯云云函数详情
|
||||
GetFunctions(ctx context.Context, in *GetFunctionsReq, opts ...grpc.CallOption) (*GetFunctionsResp, error)
|
||||
}
|
||||
|
||||
defaultScf struct {
|
||||
|
@ -35,8 +56,14 @@ func NewScf(cli zrpc.Client) Scf {
|
|||
}
|
||||
}
|
||||
|
||||
// 查询腾讯云云函数列表
|
||||
// ListFunctions 查询腾讯云云函数列表
|
||||
func (m *defaultScf) ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error) {
|
||||
client := scf.NewScfClient(m.cli.Conn())
|
||||
return client.ListFunctions(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// GetFunctions 查询腾讯云云函数详情
|
||||
func (m *defaultScf) GetFunctions(ctx context.Context, in *GetFunctionsReq, opts ...grpc.CallOption) (*GetFunctionsResp, error) {
|
||||
client := scf.NewScfClient(m.cli.Conn())
|
||||
return client.GetFunctions(ctx, in, opts...)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package enum
|
||||
|
||||
type ExternalStatus string
|
||||
|
||||
const (
|
||||
EXTERNAL_RUNNING ExternalStatus = "running"
|
||||
EXTERNAL_COMPLETED ExternalStatus = "completed"
|
||||
EXTERNAL_PENDING ExternalStatus = "pending"
|
||||
EXTERNAL_SUCCEEDED ExternalStatus = "succeeded"
|
||||
EXTERNAL_FAILED ExternalStatus = "failed"
|
||||
)
|
||||
|
||||
func (s ExternalStatus) String() string {
|
||||
switch s {
|
||||
case EXTERNAL_RUNNING:
|
||||
return "Running"
|
||||
case EXTERNAL_COMPLETED:
|
||||
return "Completed"
|
||||
case EXTERNAL_PENDING:
|
||||
return "Pending"
|
||||
case EXTERNAL_SUCCEEDED:
|
||||
return "Completed"
|
||||
case EXTERNAL_FAILED:
|
||||
return "Failed"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package tool
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// DirSize 获取整体文件夹大小
|
||||
func GetDirSize(path string) (int64, error) {
|
||||
var size int64
|
||||
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||
if !info.IsDir() {
|
||||
size += info.Size()
|
||||
}
|
||||
return err
|
||||
})
|
||||
return size, err
|
||||
}
|
||||
|
||||
// PathExists 判断文件夹是否存在
|
||||
func PathExists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true, nil
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
|
@ -35,10 +35,15 @@ spec:
|
|||
volumeMounts:
|
||||
- mountPath: /home/uploads
|
||||
name: pcm-image-storage
|
||||
- mountPath: /var/run/docker.sock
|
||||
name: sock-volume
|
||||
volumes:
|
||||
- name: pcm-image-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: pcm-image-storage
|
||||
- name: sock-volume
|
||||
hostPath:
|
||||
path: /var/run/docker.sock
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
dnsPolicy: ClusterFirst
|
||||
|
|
Loading…
Reference in New Issue