model

package
v0.0.0-...-e91ad15 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterID is ACK cluster id
	ClusterID = "kubernetes.cluster.id"

	// RegionID is aliyun region id, Ex. cn-hangzhou
	RegionID = "region.id"

	// AppNamespace is namespace of dlc on ACK
	AppNamespace = "app.namespace"

	// AppName is name of develop console
	AppName = "app.name"

	DevConsoleHost = "kube-ai.dev-console.host"

	// DefaultDomain is domain of oauth app
	DefaultDomain = "default.domain"

	EnvIngressEnable = "KUBE_DL_INGRESS_ENABLE"

	EnvKubedlHOST = "KUBE_DL_HOST"

	DevConsoleDefaultNamespace = "kube-ai"

	DevConsoleDefaultName = "ack-ai-dev-console"
)
View Source
const (
	TimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(s string, keyring []byte) ([]byte, error)

func GetTimeDiffer

func GetTimeDiffer(startTime time.Time, endTime time.Time) (differ string)

GetTimeDiffer computes time differ duration between 2 time values, formated as 2h2m2s.

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func StoreUserInfoToConfigMap

func StoreUserInfoToConfigMap(userInfo UserInfo) error

Types

type AKInfo

type AKInfo struct {
	AccessKeyId     string `json:"access.key.id"`
	AccessKeySecret string `json:"access.key.secret"`
	SecurityToken   string `json:"security.token"`
	Expiration      string `json:"expiration"`
	Keyring         string `json:"keyring"`
}

func (*AKInfo) DecryptFromString

func (i *AKInfo) DecryptFromString(encodeTokenCfg string) error

type ArmsInfo

type ArmsInfo struct {
	ClusterId  string `json:"clusterId,omitempty"`
	ArmsUrl    string `json:"armsUrl,omitempty"`
	ArmsRegion string `json:"armsRegion,omitempty"`
	UserId     string `json:"aid,omitempty"`
}

type ClusterNodeInfo

type ClusterNodeInfo struct {
	NodeName      string `json:"nodeName"`
	InstanceType  string `json:"instanceType"`
	GPUType       string `json:"gpuType"`
	TotalCPU      int64  `json:"totalCPU"`
	TotalMemory   int64  `json:"totalMemory"`
	TotalGPU      int64  `json:"totalGPU"`
	RequestCPU    int64  `json:"requestCPU"`
	RequestMemory int64  `json:"requestMemory"`
	RequestGPU    int64  `json:"requestGPU"`
}

type ClusterNodeInfoList

type ClusterNodeInfoList struct {
	Items []ClusterNodeInfo `json:"items,omitempty"`
}

type ClusterRequestResource

type ClusterRequestResource struct {
	RequestCPU    int64 `json:"requestCPU"`
	RequestMemory int64 `json:"requestMemory"`
	RequestGPU    int64 `json:"requestGPU"`
}

type ClusterTotalResource

type ClusterTotalResource struct {
	TotalCPU    int64 `json:"totalCPU"`
	TotalMemory int64 `json:"totalMemory"`
	TotalGPU    int64 `json:"totalGPU"`
}

type CodeSource

type CodeSource struct {
	UserId string `json:"userid"`

	Username string `json:"username"`

	Name string `json:"name"`

	Type string `json:"type"`

	CodePath string `json:"code_path"`

	DefaultBranch string `json:"default_branch"`

	LocalPath string `json:"local_path"`

	Description string `json:"description"`

	GitUsername string `json:"git_username"`

	GitPassword string `json:"git_password"`

	CreateTime string `json:"create_time"`

	UpdateTime string `json:"update_time"`
}

type CodeSourceMap

type CodeSourceMap map[string]CodeSource

type CronHistoryInfo

type CronHistoryInfo struct {
	Name       string `json:"name,omitempty"`
	Namespace  string `json:"namespace,omitempty"`
	Kind       string `json:"type,omitempty"`
	CreateTime string `json:"createTime,omitempty"`
}

type CronInfo

type CronInfo struct {
	Name              string `json:"name,omitempty"`
	Namespace         string `json:"namespace,omitempty"`
	Kind              string `json:"type,omitempty"`
	Schedule          string `json:"schedule,omitempty"`
	ConcurrencyPolicy string `json:"concurrencyPolicy,omitempty"`
	Suspend           string `json:"suspend,omitempty"`
	Status            string `json:"status,omitempty"`
	Deadline          string `json:"deadline,omitempty"`
	HistoryLimit      int64  `json:"historyLimit,omitempty"`
	LastScheduleTime  string `json:"lastScheduleTime,omitempty"`
	CreateTime        string `json:"createTime,omitempty"`
}

func ConvertDMOCronToCronInfo

func ConvertDMOCronToCronInfo(cron *dmo.Cron) CronInfo

type DataSource

type DataSource struct {
	UserId string `json:"userid"`

	Username string `json:"username"`

	Namespace string `json:"namespace"`

	Name string `json:"name"`

	Type string `json:"type"`

	PvcName string `json:"pvc_name"`

	LocalPath string `json:"local_path"`

	Description string `json:"description"`

	CreateTime string `json:"create_time"`

	UpdateTime string `json:"update_time"`
}

type DataSourceMap

type DataSourceMap map[string]DataSource

type EvaluateJobInfo

type EvaluateJobInfo struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Namespace    string `json:"namespace"`
	Image        string `json:"image"`
	ModelName    string `json:"modelName"`
	ModelVersion string `json:"modelVersion"`
	Metrics      string `json:"metrics"`

	Status       string `json:"jobStatus"`
	CreateTime   string `json:"createTime"`
	ModifiedTime string `json:"ModifyTime"`
}

func ConvertDMOEvaluateJobToEvaluateJobInfo

func ConvertDMOEvaluateJobToEvaluateJobInfo(evaluateJob *dmo.EvaluateJob) EvaluateJobInfo

type HistoryJobStatistic

type HistoryJobStatistic struct {
	UserID string `json:"userID"`
	// UserName can be JobUserName in JobInfo
	// or JobUserID iff JobUserName is empty in JobInfo
	// or "Anonymous" if JobUserName and JobUserID are both empty.
	UserName string `json:"userName"`

	Namespace string `json:"namespace"`

	// Total job count submmitted by this user.
	JobCount int32 `json:"jobCount"`

	// Job ratio submmited by this user.
	JobRatio float64 `json:"jobRatio"`
}

HistoryJobStatistic used to record history job statistic.

type JobInfo

type JobInfo struct {
	// 任务标识
	Id string `json:"id"`
	// 任务名称
	Name string `json:"name"`
	// 任务类型
	JobType string `json:"jobType"`
	// 是否启用了TensorBoard
	EnableTensorboard bool `json:"enableTensorboard"`
	// 任务状态
	JobStatus v1.JobConditionType `json:"jobStatus"`
	// 命名空间
	Namespace string `json:"namespace"`
	// 创建时间
	CreateTime string `json:"createTime"`
	// 结束时间
	EndTime string `json:"endTime"`
	// 执行时长
	DurationTime string `json:"durationTime"`
	// 部署域
	DeployRegion string `json:"deployRegion"`
	// 退出事件列表
	ExitedEvents []string `json:"exitedEvents"`
	// 任务规格列表
	Specs []Spec `json:"specs"`
	//任务规格类型状态统计
	SpecsReplicaStatuses map[string]*SpecReplicaStatus `json:"specsReplicaStatuses"`

	Resources   string      `json:"resources,omitempty"`
	JobConfig   string      `json:"jobConfig,omitempty"`
	JobUserID   string      `json:"jobUserId,omitempty"`
	JobUserName string      `json:"jobUserName,omitempty"`
	JobResource JobResource `json:"jobResource,omitempty"`

	CreatedBy string `json:"createdBy,omitempty"`
}

JobInfo job的基础模型 一期简单定义- 平铺

func ConvertDMOJobToJobInfo

func ConvertDMOJobToJobInfo(dmoJob *dmo.Job) JobInfo

type JobResource

type JobResource struct {
	TotalCPU    int64 `json:"totalCPU"`
	TotalMemory int64 `json:"totalMemory"`
	TotalGPU    int64 `json:"totalGPU"`
}

type JobStatistics

type JobStatistics struct {
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`

	// Total job count submmitted from startTime to endTime.
	TotalJobCount int32 `json:"totalJobCount"`

	// Statistics of history jobs (All status), group by user.
	HistoryJobs []*HistoryJobStatistic `json:"historyJobs"`
}

JobStatistics used to record job statistics submitted by users in current cluster.

type OAuthApp

type OAuthApp struct {
	sync.RWMutex
	Name        string
	DisplayName string
	Context     map[string]string
}

OAuthApp is the OAuth information struct

func NewOAuthApp

func NewOAuthApp(name string, context map[string]string) (oAuthApp *OAuthApp)

NewOAuthApp create new OAuthApp Object

func (*OAuthApp) GetAppName

func (oAuthApp *OAuthApp) GetAppName() string

GetAppName return the OAuthApp unique app name

func (*OAuthApp) GetDevConsoleHost

func (oAuthApp *OAuthApp) GetDevConsoleHost() (host string, err error)

func (*OAuthApp) GetDevConsoleHostWithRetry

func (oAuthApp *OAuthApp) GetDevConsoleHostWithRetry(tryTimes int, tryIntervalSec int) (host string, err error)

func (*OAuthApp) GetDisplayName

func (oAuthApp *OAuthApp) GetDisplayName() string

GetDisplayName return the display name

func (*OAuthApp) GetName

func (oAuthApp *OAuthApp) GetName() string

GetName return the alias name of OAuthApp

func (*OAuthApp) GetRedirectURI

func (oAuthApp *OAuthApp) GetRedirectURI() string

return oauth redirect uri of

func (*OAuthApp) GetWebURI

func (oAuthApp *OAuthApp) GetWebURI() string

GetWebURI return the dlc dashboard webui domain

type OAuthInfo

type OAuthInfo struct {

	// aliCloud third-part app id
	AppId string `json:"appId"`
	// aliCloud third-part app secret
	AppSecret string `json:"appSecret"`

	WebAppRedirectDomain string   `json:"webAppRedirectDomain"`
	UserInfo             UserInfo `json:"userInfo"`
}

func GetOauthInfo

func GetOauthInfo(oauthConfig map[string]string) OAuthInfo

GetOauthInfo from configmap

type RoleAuth

type RoleAuth struct {
	Code            string `json:"Code"`
	AccessKeyId     string `json:"AccessKeyId"`
	AccessKeySecret string `json:"AccessKeySecret"`
	SecurityToken   string `json:"SecurityToken"`
	Expiration      string `json:"Expiration"`
	LastUpdated     string `json:"LastUpdated"`
}

type Spec

type Spec struct {
	// 名称
	Name  string `json:"name"`
	PodId string `json:"podId"`
	//任务类型
	ReplicaType string `json:"replicaType"`
	// 容器IP
	ContainerIp string `json:"containerIp"`
	// 容器ID
	ContainerId string `json:"containerId"`
	// 宿主机IP
	HostIp string `json:"hostIp"`
	// 状态
	Status corev1.PodPhase `json:"jobStatus"`
	// 创建时间
	CreateTime string `json:"createTime"`
	// 开始时间
	StartTime string `json:"startTime"`
	// 结束时间
	EndTime string `json:"endTime"`
	// 执行时长
	DurationTime string `json:"durationTime"`
	// 原因,目前只有失败情况下才有
	Reason string `json:"reason,omitempty"`
	// 描述,目前只有失败情况下才有
	Message string `json:"message,omitempty"`
	// 原因+描述,目前只有失败情况下才有
	Remark string `json:"remark,omitempty"`
	// GPU卡数
	GPU int `json:"gpu,omitempty"`
}

Spec 任务规格模型

func ConvertDMOPodToJobSpec

func ConvertDMOPodToJobSpec(pod *dmo.Pod) Spec

type SpecReplicaStatus

type SpecReplicaStatus struct {
	// The number of actively running pods.
	Active int32 `json:"active"`

	// The number of pods which reached phase Succeeded.
	Succeeded int32 `json:"succeeded"`

	// The number of pods which reached phase Failed.
	Failed int32 `json:"failed"`

	// The number of pods which reached phase Stopped.
	Stopped int32 `json:"stopped"`
}

SpecReplicaStatus 规格状态

type SubmitEvaluateJobArgs

type SubmitEvaluateJobArgs struct {
	dmo.SubmitEvaluateJobInfo `json:",inline"`
}

type SubmitJobArgs

type SubmitJobArgs struct {
	dmo.SubmitJobInfo `json:",inline"`
}

type UserInfo

type UserInfo struct {
	// aliCloud main account id
	Aid string `json:"aid"`
	// aliCloud login account id
	Uid string `json:"uid"`
	// aliCloud display name
	Name string `json:"name"`
	// aliCloud login name
	LoginName string `json:"login_name"`
	// aliCloud ram login account
	Upn string `json:"upn"`
	// Namespaces specifies the authorized namespaces
	Namespaces []string `json:"namespaces"`
}

func GetUserInfoFromConfigMap

func GetUserInfoFromConfigMap(userID string) (UserInfo, error)

type UserInfoMap

type UserInfoMap map[string]UserInfo

Jump to

Keyboard shortcuts

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