common

package
v0.0.0-...-8fc888b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIMEOUT           int64 = 20
	CLUSTER_AVAIL_TMP       = "11250" // 华东一区【昆山】
	SUCCESS                 = "0"
)
View Source
const (
	NOT_EXIST           = "-1"
	COMPLETED_OR_FAILED = "816820"
)

stop logic

Variables

This section is empty.

Functions

func GetAiCenterUrl

func GetAiCenterUrl(ctr *Center) string

func GetEFileUrlPrefix

func GetEFileUrlPrefix(ctr *Center) string

func GetGroupId

func GetGroupId(baseUrlAi string, getGroupMembers string, token string) string

func GetHpcCenterUrl

func GetHpcCenterUrl(ctr *Center) string

func GetJobManagerId

func GetJobManagerId(cfg *config.Config, ctr *Center, token string) int

func GetQueueId

func GetQueueId(cfg *config.Config, ctr *Center, token string) string

func GetRestyRequest

func GetRestyRequest(timeoutSeconds int64) *resty.Request

func IsAiResourceGroupAvail

func IsAiResourceGroupAvail(ctr *Center, resourceGroup string, token string) bool

func IsHpcUserQueueAvail

func IsHpcUserQueueAvail(queueId string) bool

func NewAuthService

func NewAuthService() (map[string]*AuthService, error)

Types

type AuthService

type AuthService struct {
	C                  *config.Config
	Token              string //区域用户认证token
	ClusterId          string
	AiCenterUrlPrefix  string
	HpcCenterUrlPrefix string
	EFileUrlPrefix     string
	JobManagerId       int
	GroupId            string
	QueueId            string
	ResourceGroupAvail bool
	UserQueueAvail     bool
}

func GetAuthServiceWithResource

func GetAuthServiceWithResource(asv map[string]*AuthService) (*AuthService, error)

func (*AuthService) GetAiCenterUrlPrefix

func (a *AuthService) GetAiCenterUrlPrefix() string

func (*AuthService) GetClusterId

func (a *AuthService) GetClusterId() string

func (*AuthService) GetConfig

func (a *AuthService) GetConfig() *config.Config

func (*AuthService) GetEFileUrlPrefix

func (a *AuthService) GetEFileUrlPrefix() string

func (*AuthService) GetGroupId

func (a *AuthService) GetGroupId() string

func (*AuthService) GetHpcCenterUrlPrefix

func (a *AuthService) GetHpcCenterUrlPrefix() string

func (*AuthService) GetJobManagerId

func (a *AuthService) GetJobManagerId() int

func (*AuthService) GetQueueId

func (a *AuthService) GetQueueId() string

func (*AuthService) GetToken

func (a *AuthService) GetToken() string

type Center

type Center struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Id          int           `json:"id"`
		Name        string        `json:"name"`
		Description string        `json:"description"`
		IngressUrls []interface{} `json:"ingressUrls"`
		EfileUrls   []struct {
			NodeName        string `json:"nodeName"`
			Enable          string `json:"enable"`
			AppId           string `json:"appId,omitempty"`
			FastTransEnable string `json:"fastTransEnable"`
			AppSecret       string `json:"appSecret,omitempty"`
			UdpPort         string `json:"udpPort"`
			IsManagerNode   string `json:"isManagerNode,omitempty"`
			Version         string `json:"version"`
			Url             string `json:"url"`
		} `json:"efileUrls"`
		EshellUrls []struct {
			NodeName        string `json:"nodeName"`
			Enable          string `json:"enable"`
			AppId           string `json:"appId"`
			FastTransEnable string `json:"fastTransEnable"`
			AppSecret       string `json:"appSecret"`
			UdpPort         string `json:"udpPort"`
			IsManagerNode   string `json:"isManagerNode"`
			Version         string `json:"version"`
			Url             string `json:"url"`
		} `json:"eshellUrls"`
		HpcUrls []struct {
			Enable          string `json:"enable"`
			IsManagerNode   string `json:"isManagerNode"`
			Version         string `json:"version"`
			Url             string `json:"url"`
			NodeName        string `json:"nodeName,omitempty"`
			AppId           string `json:"appId,omitempty"`
			FastTransEnable string `json:"fastTransEnable,omitempty"`
			AppSecret       string `json:"appSecret,omitempty"`
			UdpPort         string `json:"udpPort,omitempty"`
		} `json:"hpcUrls"`
		AiUrls []struct {
			NodeName        string `json:"nodeName"`
			Enable          string `json:"enable"`
			AppId           string `json:"appId"`
			FastTransEnable string `json:"fastTransEnable"`
			AppSecret       string `json:"appSecret"`
			UdpPort         string `json:"udpPort"`
			IsManagerNode   string `json:"isManagerNode"`
			Version         string `json:"version"`
			Url             string `json:"url"`
			SchedulerType   string `json:"schedulerType"`
		} `json:"aiUrls"`
		EshellSshHosts []struct {
			Enable string `json:"enable"`
			Url    string `json:"url"`
		} `json:"eshellSshHosts"`
		InternetSshHosts []struct {
			LimitState string `json:"limitState"`
			Url        string `json:"url"`
		} `json:"internetSshHosts"`
		ClusterUserInfo struct {
			UserName  string `json:"userName"`
			HomePath  string `json:"homePath"`
			UserId    string `json:"userId"`
			UserGroup string `json:"userGroup"`
			UserShell string `json:"userShell"`
		} `json:"clusterUserInfo"`
	} `json:"data"`
}

func GetCenterUrls

func GetCenterUrls(baseUrlAi string, centerUrl string, token string) (*Center, error)

type CenterResp

type CenterResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Id          int           `json:"id"`
		Name        string        `json:"name"`
		Description string        `json:"description"`
		IngressUrls []interface{} `json:"ingressUrls"`
		EfileUrls   []struct {
			NodeName        string `json:"nodeName"`
			Enable          string `json:"enable"`
			FastTransEnable string `json:"fastTransEnable"`
			UdpPort         string `json:"udpPort"`
			Version         string `json:"version"`
			Url             string `json:"url"`
			AppId           string `json:"appId,omitempty"`
			AppSecret       string `json:"appSecret,omitempty"`
			IsManagerNode   string `json:"isManagerNode,omitempty"`
		} `json:"efileUrls"`
		EshellUrls []struct {
			Enable          string `json:"enable"`
			Version         string `json:"version"`
			Url             string `json:"url"`
			NodeName        string `json:"nodeName,omitempty"`
			AppId           string `json:"appId,omitempty"`
			AppSecret       string `json:"appSecret,omitempty"`
			FastTransEnable string `json:"fastTransEnable,omitempty"`
			UdpPort         string `json:"udpPort,omitempty"`
			IsManagerNode   string `json:"isManagerNode,omitempty"`
		} `json:"eshellUrls"`
		HpcUrls []struct {
			Enable        string `json:"enable"`
			IsManagerNode string `json:"isManagerNode"`
			Version       string `json:"version"`
			Url           string `json:"url"`
		} `json:"hpcUrls"`
		AiUrls []struct {
			Enable  string `json:"enable"`
			Version string `json:"version"`
			Url     string `json:"url"`
		} `json:"aiUrls"`
		EshellSshHosts []struct {
			Enable          string `json:"enable"`
			Url             string `json:"url"`
			NodeName        string `json:"nodeName,omitempty"`
			AppId           string `json:"appId,omitempty"`
			AppSecret       string `json:"appSecret,omitempty"`
			FastTransEnable string `json:"fastTransEnable,omitempty"`
			UdpPort         string `json:"udpPort,omitempty"`
			IsManagerNode   string `json:"isManagerNode,omitempty"`
			Version         string `json:"version,omitempty"`
		} `json:"eshellSshHosts"`
		InternetSshHosts []struct {
			LimitState string `json:"limitState"`
			Url        string `json:"url"`
		} `json:"internetSshHosts"`
		ClusterUserInfo struct {
			UserName string `json:"userName"`
			HomePath string `json:"homePath"`
		} `json:"clusterUserInfo"`
	} `json:"data"`
}

type ClusterResp

type ClusterResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data []struct {
		JobManagerAddr string `json:"JobManagerAddr"`
		JobManagerType string `json:"JobManagerType"`
		Id             int    `json:"id"`
		Text           string `json:"text"`
		JobManagerPort string `json:"JobManagerPort"`
	} `json:"data"`
}

type ClusterTokens

type ClusterTokens struct {
	ClusterId   string
	ClusterName string
	Token       string
}

func GetClusterTokens

func GetClusterTokens(cfg *config.Config) ([]*ClusterTokens, error)

type GroupMembers

type GroupMembers struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data []struct {
		AccountId        string `json:"accountId"`
		AccountName      string `json:"accountName"`
		GroupDisplayName string `json:"groupDisplayName"`
		GroupId          string `json:"groupId"`
		GroupRole        string `json:"groupRole"`
		GroupUsersInfos  []struct {
			UserId          string `json:"userId"`
			UserName        string `json:"userName"`
			ClusterId       string `json:"clusterId"`
			ClusterUserName string `json:"clusterUserName"`
		} `json:"groupUsersInfos"`
	} `json:"data"`
}

type ParastorQuota

type ParastorQuota struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data []struct {
		Username  interface{} `json:"username"`
		Path      string      `json:"path"`
		Threshold int         `json:"threshold"`
		Usage     float64     `json:"usage"`
	} `json:"data"`
}

type QueueNamesResp

type QueueNamesResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data []struct {
		QueuePriority  int    `json:"queuePriority"`
		QueFreeNcpus   string `json:"queFreeNcpus"`
		QueNodes       string `json:"queNodes"`
		QueNcpus       string `json:"queNcpus"`
		QueMaxNgpus    string `json:"queMaxNgpus"`
		QueMaxPPN      string `json:"queMaxPPN"`
		QueChargeRate  string `json:"queChargeRate"`
		QueMaxNcpus    string `json:"queMaxNcpus"`
		AclHosts       string `json:"aclHosts"`
		QueMaxNdcus    string `json:"queMaxNdcus"`
		QueueName      string `json:"queueName"`
		QueMaxNmlus    string `json:"queMaxNmlus"`
		QueFreeNodes   string `json:"queFreeNodes"`
		QueMaxNodect   string `json:"queMaxNodect"`
		QueMaxGpuPN    string `json:"queMaxGpuPN"`
		Id             string `json:"id"`
		Text           string `json:"text"`
		QueMaxWalltime string `json:"queMaxWalltime"`
		QueMaxDcuPN    string `json:"queMaxDcuPN"`
		QueueEnabled   bool   `json:"queueEnabled"`
	} `json:"data"`
}

type QuotaResp

type QuotaResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		UserName            interface{} `json:"userName"`
		AccountName         interface{} `json:"accountName"`
		UserMaxCpu          int         `json:"userMaxCpu"`
		UserMaxDcu          int         `json:"userMaxDcu"`
		UserMaxGpu          int         `json:"userMaxGpu"`
		UserMaxMlu          int         `json:"userMaxMlu"`
		UserMaxMem          int         `json:"userMaxMem"`
		UserMaxNode         int         `json:"userMaxNode"`
		UserMaxSubmitJob    int         `json:"userMaxSubmitJob"`
		UserMaxRunJob       int         `json:"userMaxRunJob"`
		AccountMaxCpu       int         `json:"accountMaxCpu"`
		AccountMaxDcu       int         `json:"accountMaxDcu"`
		AccountMaxGpu       int         `json:"accountMaxGpu"`
		AccountMaxMlu       int         `json:"accountMaxMlu"`
		AccountMaxMem       int         `json:"accountMaxMem"`
		AccountMaxNode      int         `json:"accountMaxNode"`
		AccountMaxSubmitJob int         `json:"accountMaxSubmitJob"`
		AccountMaxRunJob    int         `json:"accountMaxRunJob"`
		UserMinCpu          int         `json:"userMinCpu"`
		UserMinNode         int         `json:"userMinNode"`
		MaxWallTime         int         `json:"maxWallTime"`
	} `json:"data"`
}

type ResourceGroupResp

type ResourceGroupResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Dcu []string `json:"dcu"`
		Cpu []string `json:"cpu"`
	} `json:"data"`
}

type ResourceResp

type ResourceResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Id            interface{} `json:"id"`
		CpuNumber     int         `json:"cpuNumber"`
		MluLimits     int         `json:"mluLimits"`
		DcuLimits     int         `json:"dcuLimits"`
		NvLimits      int         `json:"nvLimits"`
		GpuNumber     int         `json:"gpuNumber"`
		MemorySize    int         `json:"memorySize"`
		ResourceGroup string      `json:"resourceGroup"`
		UserName      interface{} `json:"userName"`
		NodeNumber    int         `json:"nodeNumber"`
		MaxTime       string      `json:"maxTime"`
	} `json:"data"`
}

type TokenResp

type TokenResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data []struct {
		ClusterId   string `json:"clusterId"`
		ClusterName string `json:"clusterName"`
		Token       string `json:"token"`
	} `json:"data"`
}

type TokenState

type TokenState struct {
	Msg  string `json:"msg"`
	Code string `json:"code"`
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL