Merge pull request '移除ceph' (#322) from zhangweiii/pcm-coordinator:master into master

Former-commit-id: 5d505e3b8ba3c6e2bdeafe442014d9d2fe824bf8
This commit is contained in:
zhangweiii 2024-10-22 19:05:25 +08:00
commit 702cf72ebc
20 changed files with 7735 additions and 9695 deletions

View File

@ -98,6 +98,7 @@ type HpcInfo struct {
Account string `json:"account"` Account string `json:"account"`
WorkDir string `json:"work_dir"` // 工作路径 WorkDir string `json:"work_dir"` // 工作路径
AssocId int64 `json:"assoc_id"` AssocId int64 `json:"assoc_id"`
Partition string `json:"partition,omitempty,optional"`
ExitCode int64 `json:"exit_code"` ExitCode int64 `json:"exit_code"`
WallTime string `json:"wall_time"` // 最大运行时间 WallTime string `json:"wall_time"` // 最大运行时间
Result string `json:"result"` // 运行结果 Result string `json:"result"` // 运行结果
@ -111,7 +112,7 @@ type HpcInfo struct {
StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j
StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j
StdInput string `json:"std_input"` StdInput string `json:"std_input"`
Environment string `json:"environment"` Environment map[string]string `json:"environment"`
DeletedFlag int64 `json:"deleted_flag"` // 是否删除0-否1-是) DeletedFlag int64 `json:"deleted_flag"` // 是否删除0-否1-是)
CreatedBy int64 `json:"created_by"` // 创建人 CreatedBy int64 `json:"created_by"` // 创建人
CreatedTime time.Time `json:"created_time"` // 创建时间 CreatedTime time.Time `json:"created_time"` // 创建时间

View File

@ -41,7 +41,7 @@ type (
Message string `json:"message"` Message string `json:"message"`
Data HomeOverviewData `json:"data"` Data HomeOverviewData `json:"data"`
} }
HomeOverviewData{ HomeOverviewData {
AdaptSum int64 `json:"adaptSum"` AdaptSum int64 `json:"adaptSum"`
ClusterSum int64 `json:"clusterSum"` ClusterSum int64 `json:"clusterSum"`
StorageSum float32 `json:"storageSum"` StorageSum float32 `json:"storageSum"`
@ -92,7 +92,6 @@ type (
Id int `json:"id"` Id int `json:"id"`
PublicNetworkName string `json:"public_netWork_name"` PublicNetworkName string `json:"public_netWork_name"`
} }
) )
type remoteResp { type remoteResp {
@ -176,7 +175,6 @@ type (
AdapterName string `json:"adapterName"` AdapterName string `json:"adapterName"`
PodName string `json:"podName"` PodName string `json:"podName"`
stream bool `json:"stream"` stream bool `json:"stream"`
} }
) )
@ -267,7 +265,7 @@ type (
Replica int32 `json:"replica"` Replica int32 `json:"replica"`
Msg string `json:"msg"` Msg string `json:"msg"`
} }
VmTask{ VmTask {
Id string `json:"id" copier:"Id"` Id string `json:"id" copier:"Id"`
Links []VmLinks `json:"links" copier:"Links"` Links []VmLinks `json:"links" copier:"Links"`
OSDCFDiskConfig string `json:"OS_DCF_diskConfig" copier:"OSDCFDiskConfig"` OSDCFDiskConfig string `json:"OS_DCF_diskConfig" copier:"OSDCFDiskConfig"`
@ -278,41 +276,41 @@ type (
Href string `json:"href " copier:"Href"` Href string `json:"href " copier:"Href"`
Rel string `json:"rel" copier:"Rel"` Rel string `json:"rel" copier:"Rel"`
} }
// commitVmTaskReq { // commitVmTaskReq {
// Name string `json:"name"` // Name string `json:"name"`
// NsID string `json:"nsID"` // NsID string `json:"nsID"`
// Replicas int64 `json:"replicas,optional"` // Replicas int64 `json:"replicas,optional"`
// MatchLabels map[string]string `json:"matchLabels,optional"` // MatchLabels map[string]string `json:"matchLabels,optional"`
// AdapterId string `json:"adapterId,optional"` // AdapterId string `json:"adapterId,optional"`
// ClusterType string `json:"clusterType,optional"` // ClusterType string `json:"clusterType,optional"`
// //Virtual Machine Section // //Virtual Machine Section
// CreateMulServer []CreateMulDomainServer `json:"createMulServer,optional"` // CreateMulServer []CreateMulDomainServer `json:"createMulServer,optional"`
// } // }
// CreateMulDomainServer { // CreateMulDomainServer {
// Platform string `json:"platform,optional"` // Platform string `json:"platform,optional"`
// Name string `json:"name,optional"` // Name string `json:"name,optional"`
// Min_count int64 `json:"min_count,optional"` // Min_count int64 `json:"min_count,optional"`
// ImageRef string `json:"imageRef,optional"` // ImageRef string `json:"imageRef,optional"`
// FlavorRef string `json:"flavorRef,optional"` // FlavorRef string `json:"flavorRef,optional"`
// Uuid string `json:"uuid,optional"` // Uuid string `json:"uuid,optional"`
// } // }
// commitVmTaskResp { // commitVmTaskResp {
// // VmTask []VmTask `json:"vmTask" copier:"VmTask"` // // VmTask []VmTask `json:"vmTask" copier:"VmTask"`
// TaskId int64 `json:"taskId"` // TaskId int64 `json:"taskId"`
// Code int32 `json:"code"` // Code int32 `json:"code"`
// Msg string `json:"msg"` // Msg string `json:"msg"`
// } // }
// VmTask { // VmTask {
// Id string `json:"id" copier:"Id"` // Id string `json:"id" copier:"Id"`
// Links []VmLinks `json:"links" copier:"Links"` // Links []VmLinks `json:"links" copier:"Links"`
// OSDCFDiskConfig string `json:"OS_DCF_diskConfig" copier:"OSDCFDiskConfig"` // OSDCFDiskConfig string `json:"OS_DCF_diskConfig" copier:"OSDCFDiskConfig"`
// SecurityGroups []VmSecurity_groups_server `json:"security_groups" copier:"SecurityGroups"` // SecurityGroups []VmSecurity_groups_server `json:"security_groups" copier:"SecurityGroups"`
// AdminPass string `json:"adminPass" copier:"AdminPass"` // AdminPass string `json:"adminPass" copier:"AdminPass"`
// } // }
// VmLinks { // VmLinks {
// Href string `json:"href " copier:"Href"` // Href string `json:"href " copier:"Href"`
// Rel string `json:"rel" copier:"Rel"` // Rel string `json:"rel" copier:"Rel"`
// } // }
VmSecurity_groups_server { VmSecurity_groups_server {
Name string `json:"name" copier:"Name"` Name string `json:"name" copier:"Name"`
@ -515,6 +513,14 @@ type ScreenChartResp {
CenterName string `json:"centerName"` CenterName string `json:"centerName"`
} }
type getClusterByIdReq {
ClusterId int32 `path:"clusterId"`
}
type getClusterByIdResp {
ClusterInfo ClusterInfo `json:"clusterInfo"`
}
type ScreenInfoResp { type ScreenInfoResp {
@ -867,6 +873,7 @@ type (
ProducerDict string `json:"producerDict,optional"` ProducerDict string `json:"producerDict,optional"`
RegionDict string `json:"regionDict,optional"` RegionDict string `json:"regionDict,optional"`
RegionName string `json:"regionName,optional"` RegionName string `json:"regionName,optional"`
Environment map[string]string `json:"environment,optional"`
} }
ClusterInfo { ClusterInfo {
Id string `json:"id,omitempty" db:"id"` Id string `json:"id,omitempty" db:"id"`
@ -891,6 +898,7 @@ type (
RegionDict string `json:"regionDict,omitempty" db:"region_dict"` RegionDict string `json:"regionDict,omitempty" db:"region_dict"`
Location string `json:"location,omitempty" db:"location"` Location string `json:"location,omitempty" db:"location"`
CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"` CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
Environment map[string]string `json:"environment,omitempty" db:"environment"`
} }
) )
@ -1076,7 +1084,7 @@ type (
PageNum int `json:"pageNum,omitempty"` PageNum int `json:"pageNum,omitempty"`
PageSize int `json:"pageSize,omitempty"` PageSize int `json:"pageSize,omitempty"`
} }
ListResult{ ListResult {
List interface{} `json:"list,omitempty"` List interface{} `json:"list,omitempty"`
} }
) )
@ -1225,7 +1233,8 @@ type (
TaskName string `json:"taskName"` TaskName string `json:"taskName"`
Incident string `json:"incident"` Incident string `json:"incident"`
} }
ListNoticeReq {} ListNoticeReq{
}
ListNoticeResp { ListNoticeResp {
Code int64 `json:"code"` Code int64 `json:"code"`
@ -1288,7 +1297,7 @@ type (
AdapterTypeDict string `json:"adapterTypeDict"` AdapterTypeDict string `json:"adapterTypeDict"`
} }
SubTaskInfo{ SubTaskInfo {
Id string `json:"id" db:"id"` Id string `json:"id" db:"id"`
Name string `json:"name" db:"name"` Name string `json:"name" db:"name"`
ClusterId string `json:"clusterId" db:"cluster_id"` ClusterId string `json:"clusterId" db:"cluster_id"`

View File

@ -10,11 +10,13 @@ info(
type ( type (
commitHpcTaskReq { commitHpcTaskReq {
Name string `json:"name"` // paratera:jobName ClusterId int64 `json:"clusterId,optional"`
Name string `json:"name"`
Account string `json:"account,optional"`
Description string `json:"description,optional"` Description string `json:"description,optional"`
TenantId int64 `json:"tenantId,optional"` TenantId int64 `json:"tenantId,optional"`
TaskId int64 `json:"taskId,optional"` TaskId int64 `json:"taskId,optional"`
AdapterIds []string `json:"adapterIds"` AdapterIds []string `json:"adapterIds,optional"`
MatchLabels map[string]string `json:"matchLabels,optional"` MatchLabels map[string]string `json:"matchLabels,optional"`
CardCount int64 `json:"cardCount,optional"` CardCount int64 `json:"cardCount,optional"`
WorkDir string `json:"workDir,optional"` //paratera:workingDir WorkDir string `json:"workDir,optional"` //paratera:workingDir

View File

@ -166,6 +166,10 @@ service pcm {
@doc "screen" @doc "screen"
@handler getScreenChartHandler @handler getScreenChartHandler
get /core/getScreenChart returns (ScreenChartResp) get /core/getScreenChart returns (ScreenChartResp)
@doc "根据集群id获取集群信息"
@handler getClusterByIdHandler
get /core/getClusterById (getClusterByIdReq)returns (getClusterByIdResp)
} }
//hpc二级接口 //hpc二级接口
@ -387,7 +391,7 @@ service pcm {
@doc "文本识别" @doc "文本识别"
@handler ChatHandler @handler ChatHandler
post /ai/chat (ChatReq) returns (ChatResult) post /ai/chat (ChatReq) returns (ChatResult)
/******chat end***********/ /******chat end***********/
} }
//screen接口 //screen接口
@ -1060,4 +1064,3 @@ service pcm {
@handler scheduleSituationHandler @handler scheduleSituationHandler
get /monitoring/schedule/situation returns (scheduleSituationResp) get /monitoring/schedule/situation returns (scheduleSituationResp)
} }

1
go.mod
View File

@ -23,7 +23,6 @@ require (
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d
go.opentelemetry.io/otel/trace v1.30.0 go.opentelemetry.io/otel/trace v1.30.0
gonum.org/v1/gonum v0.11.0 gonum.org/v1/gonum v0.11.0
google.golang.org/grpc v1.66.2 google.golang.org/grpc v1.66.2

2
go.sum
View File

@ -476,8 +476,6 @@ gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 h1:s6
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8= gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8=
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0= gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0=
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5/go.mod h1:97AlUXN13g9UN3+9/DzCHpeoU5sbdyv0IQuTEHNexzQ= gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5/go.mod h1:97AlUXN13g9UN3+9/DzCHpeoU5sbdyv0IQuTEHNexzQ=
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d h1:DHjl/rLuH2gKYtY0MKMGNQDHFT12APg25RlMUQo+tHk=
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d/go.mod h1:r/KLzUpupCV5jdxSfgDhc2pVjP0fBi3VhAWRttsBn30=
go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0= go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0=
go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28= go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28=
go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q= go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q=

View File

@ -33,7 +33,6 @@ type Config struct {
THRpcConf zrpc.RpcClientConf THRpcConf zrpc.RpcClientConf
ModelArtsRpcConf zrpc.RpcClientConf ModelArtsRpcConf zrpc.RpcClientConf
ModelArtsImgRpcConf zrpc.RpcClientConf ModelArtsImgRpcConf zrpc.RpcClientConf
CephRpcConf zrpc.RpcClientConf
OpenstackRpcConf zrpc.RpcClientConf OpenstackRpcConf zrpc.RpcClientConf
OctopusRpcConf zrpc.RpcClientConf OctopusRpcConf zrpc.RpcClientConf
PcmCoreRpcConf zrpc.RpcClientConf PcmCoreRpcConf zrpc.RpcClientConf

View File

@ -1,25 +0,0 @@
package cloud
import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
)
func ClusterInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ClusterInfoReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := cloud.NewClusterInfoLogic(r.Context(), svcCtx)
resp, err := l.ClusterInfo(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -0,0 +1,28 @@
package core
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
)
func GetClusterByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetClusterByIdReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := core.NewGetClusterByIdLogic(r.Context(), svcCtx)
resp, err := l.GetClusterById(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -18,7 +18,7 @@ func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
} }
l := core.NewPullTaskInfoLogic(r.Context(), svcCtx) l := core.NewPullTaskInfoLogic(r.Context(), svcCtx)
resp, err := l.PullTaskInfo((*clientCore.PullTaskInfoReq)(&req)) resp, err := l.PullTaskInfo(&req)
if err != nil { if err != nil {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
} else { } else {

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,13 @@ func NewCreateClusterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
} }
func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *types.ClusterResp, err error) { func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *types.ClusterResp, err error) {
// 校验集群名称是否唯一
var count int64
l.svcCtx.DbEngin.Table("t_cluster").Where("name = ?", req.Name).Count(&count)
if count > 0 {
return nil, errors.New("the cluster name is already in use")
}
// 校验驱动器是否存在
adapter := &types.AdapterInfo{} adapter := &types.AdapterInfo{}
result := l.svcCtx.DbEngin.Table("t_adapter").First(&adapter, req.AdapterId) result := l.svcCtx.DbEngin.Table("t_adapter").First(&adapter, req.AdapterId)
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
@ -45,6 +52,9 @@ func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *t
cluster.OwnerId = "0" cluster.OwnerId = "0"
// 获取集群经纬度 // 获取集群经纬度
//location, err := GeoMap(req.RegionName) //location, err := GeoMap(req.RegionName)
//if err != nil {
// return nil, err
//}
//cluster.Location = location //cluster.Location = location
cluster.Id = tool.GenSnowflakeIDStr() cluster.Id = tool.GenSnowflakeIDStr()
@ -54,14 +64,11 @@ func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *t
return nil, errors.New("cluster create failed") return nil, errors.New("cluster create failed")
} }
if err != nil {
return nil, err
}
// push cluster info to adapter // push cluster info to adapter
go func() {
var adapterServer string var adapterServer string
l.svcCtx.DbEngin.Raw("select server from t_adapter where id = ?", req.AdapterId).Scan(&adapterServer) l.svcCtx.DbEngin.Raw("select server from t_adapter where id = ?", req.AdapterId).Scan(&adapterServer)
response, err := l.svcCtx.HttpClient.R(). l.svcCtx.HttpClient.R().
SetBody(&types.ClusterInfo{ SetBody(&types.ClusterInfo{
Name: req.Name, Name: req.Name,
Server: req.Server, Server: req.Server,
@ -70,12 +77,9 @@ func (l *CreateClusterLogic) CreateCluster(req *types.ClusterCreateReq) (resp *t
}). }).
ForceContentType("application/json"). ForceContentType("application/json").
Post(adapterServer + "/api/v1/cluster/info") Post(adapterServer + "/api/v1/cluster/info")
if err != nil {
return nil, err }()
}
if response.IsError() {
return nil, errors.New(string(response.Body()))
}
return return
} }

View File

@ -33,6 +33,12 @@ func (l *UpdateClusterLogic) UpdateCluster(req *types.ClusterCreateReq) (resp *t
return nil, errors.New("cluster does not exist") return nil, errors.New("cluster does not exist")
} }
utils.Convert(req, &cluster) utils.Convert(req, &cluster)
// 获取集群经纬度
location, err := GeoMap(req.RegionName)
if err != nil {
return nil, err
}
cluster.Location = location
l.svcCtx.DbEngin.Table("t_cluster").Model(&cluster).Updates(&cluster) l.svcCtx.DbEngin.Table("t_cluster").Model(&cluster).Updates(&cluster)
return return
} }

View File

@ -1,30 +0,0 @@
package cloud
import (
"context"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type ClusterInfoLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewClusterInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClusterInfoLogic {
return &ClusterInfoLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ClusterInfoLogic) ClusterInfo(req *types.ClusterInfoReq) (resp *types.ClusterInfoResp, err error) {
// todo: add your logic here and delete this line
return
}

View File

@ -0,0 +1,35 @@
package core
import (
"context"
"github.com/pkg/errors"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type GetClusterByIdLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetClusterByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClusterByIdLogic {
return &GetClusterByIdLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetClusterByIdLogic) GetClusterById(req *types.GetClusterByIdReq) (resp *types.GetClusterByIdResp, err error) {
resp = &types.GetClusterByIdResp{}
tx := l.svcCtx.DbEngin.Raw("select * from t_cluster where id = ?", req.ClusterId).Scan(&resp)
if tx.Error != nil {
logx.Errorf(tx.Error.Error())
return nil, errors.New("cluster create failed")
}
return resp, nil
}

View File

@ -53,7 +53,7 @@ func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clie
} }
var clusterType string var clusterType string
l.svcCtx.DbEngin.Raw("SELECT label FROM `t_cluster` where id = ? ", hpcInfo.ClusterId).Scan(&clusterType) l.svcCtx.DbEngin.Raw("SELECT label FROM `t_cluster` where id = ? ", hpcInfo.ClusterId).Scan(&clusterType)
utils.Convert(hpcInfo.Environment, &resp.HpcInfoList[i].Environment)
resp.HpcInfoList[i].ClusterType = clusterType resp.HpcInfoList[i].ClusterType = clusterType
} }
} }

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"errors" "errors"
clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/client" clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/client"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
"k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/json"
"math/rand" "math/rand"
@ -36,10 +35,6 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
taskModel := models.Task{ taskModel := models.Task{
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
Status: constants.Saved,
Strategy: 0,
SynergyStatus: 0,
CommitTime: time.Now(),
AdapterTypeDict: "2", AdapterTypeDict: "2",
} }
@ -76,7 +71,6 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
ClusterId: uint(clusterId), ClusterId: uint(clusterId),
ClusterName: clusterName, ClusterName: clusterName,
Name: taskModel.Name, Name: taskModel.Name,
Status: "Saved",
CmdScript: req.CmdScript, CmdScript: req.CmdScript,
StartTime: time.Now().String(), StartTime: time.Now().String(),
CardCount: req.CardCount, CardCount: req.CardCount,
@ -87,15 +81,11 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
Queue: req.Queue, Queue: req.Queue,
SubmitType: req.SubmitType, SubmitType: req.SubmitType,
NNode: req.NNode, NNode: req.NNode,
Account: req.Account,
StdOutFile: req.StdOutFile, StdOutFile: req.StdOutFile,
StdErrFile: req.StdErrFile, StdErrFile: req.StdErrFile,
StdInput: req.StdInput, StdInput: req.StdInput,
Partition: req.Partition, Partition: req.Partition,
DeletedFlag: 0,
CreatedBy: 0,
CreatedTime: time.Now(),
UpdatedBy: 0,
UpdatedTime: time.Now(),
Environment: string(env), Environment: string(env),
} }
@ -111,7 +101,6 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
NoticeType: "create", NoticeType: "create",
TaskName: req.Name, TaskName: req.Name,
Incident: "任务创建中", Incident: "任务创建中",
CreatedTime: time.Now(),
} }
result := l.svcCtx.DbEngin.Table("t_notice").Create(&noticeInfo) result := l.svcCtx.DbEngin.Table("t_notice").Create(&noticeInfo)
if result.Error != nil { if result.Error != nil {

View File

@ -1,61 +0,0 @@
/*
Copyright (c) [2023] [pcm]
[pcm-coordinator] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
package storage
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
"gitlink.org.cn/jcce-pcm/pcm-participant-ceph/ceph"
"k8s.io/apimachinery/pkg/util/json"
"github.com/zeromicro/go-zero/core/logx"
)
type ScreenStorageLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewScreenStorageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ScreenStorageLogic {
return &ScreenStorageLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ScreenStorageLogic) ScreenStorage(req *types.StorageScreenReq) (resp *types.StorageScreenResp, err error) {
// todo: add your logic here and delete this line
storageScreenReq := &ceph.StorageScreenReq{}
err = copier.CopyWithOption(storageScreenReq, req, copier.Option{Converters: utils.Converters})
StorageScreenResp, err := l.svcCtx.CephRpc.StorageScreen(l.ctx, storageScreenReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db storage list"), "Failed to get db storage list err : %v ,req:%+v", err, req)
}
marshal, err := json.Marshal(&StorageScreenResp)
if err != nil {
return nil, result.NewDefaultError(err.Error())
}
json.Unmarshal(marshal, &resp)
err = copier.CopyWithOption(&resp, &StorageScreenResp, copier.Option{Converters: utils.Converters})
return resp, nil
}

View File

@ -33,7 +33,6 @@ import (
"gitlink.org.cn/JointCloud/pcm-octopus/octopusclient" "gitlink.org.cn/JointCloud/pcm-octopus/octopusclient"
"gitlink.org.cn/JointCloud/pcm-openstack/openstackclient" "gitlink.org.cn/JointCloud/pcm-openstack/openstackclient"
slurmClient "gitlink.org.cn/JointCloud/pcm-slurm/slurmclient" slurmClient "gitlink.org.cn/JointCloud/pcm-slurm/slurmclient"
"gitlink.org.cn/jcce-pcm/pcm-participant-ceph/cephclient"
"gorm.io/driver/mysql" "gorm.io/driver/mysql"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
@ -51,7 +50,6 @@ type ServiceContext struct {
ACRpc hpcacclient.HpcAC ACRpc hpcacclient.HpcAC
THRpc slurmClient.Slurm THRpc slurmClient.Slurm
OctopusRpc octopusclient.Octopus OctopusRpc octopusclient.Octopus
CephRpc cephclient.Ceph
OpenstackRpc openstackclient.Openstack OpenstackRpc openstackclient.Openstack
MonitorClient map[int64]tracker.Prometheus MonitorClient map[int64]tracker.Prometheus
PromClient tracker.Prometheus PromClient tracker.Prometheus
@ -128,7 +126,6 @@ func NewServiceContext(c config.Config) *ServiceContext {
RedisClient: redisClient, RedisClient: redisClient,
ModelArtsRpc: modelartsservice.NewModelArtsService(zrpc.MustNewClient(c.ModelArtsRpcConf)), ModelArtsRpc: modelartsservice.NewModelArtsService(zrpc.MustNewClient(c.ModelArtsRpcConf)),
ModelArtsImgRpc: imagesservice.NewImagesService(zrpc.MustNewClient(c.ModelArtsImgRpcConf)), ModelArtsImgRpc: imagesservice.NewImagesService(zrpc.MustNewClient(c.ModelArtsImgRpcConf)),
CephRpc: cephclient.NewCeph(zrpc.MustNewClient(c.CephRpcConf)),
ACRpc: hpcacclient.NewHpcAC(zrpc.MustNewClient(c.ACRpcConf)), ACRpc: hpcacclient.NewHpcAC(zrpc.MustNewClient(c.ACRpcConf)),
OctopusRpc: octopusclient.NewOctopus(zrpc.MustNewClient(c.OctopusRpcConf)), OctopusRpc: octopusclient.NewOctopus(zrpc.MustNewClient(c.OctopusRpcConf)),
OpenstackRpc: openstackclient.NewOpenstack(zrpc.MustNewClient(c.OpenstackRpcConf)), OpenstackRpc: openstackclient.NewOpenstack(zrpc.MustNewClient(c.OpenstackRpcConf)),

File diff suppressed because it is too large Load Diff