model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobInfoTimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

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 GetUserInfoConfigMap

func GetUserInfoConfigMap() (*v1.ConfigMap, error)

Types

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"`

	CreateTime string `json:"create_time"`

	UpdateTime string `json:"update_time"`
}

type CodeSourceMap

type CodeSourceMap map[string]CodeSource

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 HistoryJobStatistic

type HistoryJobStatistic struct {
	// UserName can be JobUserName in JobInfo
	// or "Anonymous" if JobUserName is empty.
	UserName string `json:"userName"`

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

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

HistoryJobStatistic used to record history job statistic.

type JobInfo

type JobInfo struct {
	// Id: unique id
	Id string `json:"id"`
	// Name: job name
	Name string `json:"name"`
	// JobType: type
	JobType string `json:"jobType"`
	// Enable Tensorboard or not
	EnableTensorboard bool `json:"enableTensorboard"`
	// status of job
	JobStatus v1.JobConditionType `json:"jobStatus"`
	// Namespace
	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"`

	JobConfig string `json:"jobConfig,omitempty"`

	JobUserName string `json:"jobUserName,omitempty"`
}

JobInfo job meta info

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 Spec

type Spec struct {
	Name  string `json:"name"`
	PodId string `json:"podId"`
	//
	ReplicaType string `json:"replicaType"`
	//
	ContainerIp string `json:"containerIp"`
	//
	ContainerId string `json:"containerId"`
	//
	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 of failed
	Reason string `json:"reason,omitempty"`
	// Message of failed
	Message string `json:"message,omitempty"`
	// Reason + Message
	Remark string `json:"remark,omitempty"`
}

Spec pods spec of job

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 status of pods

type UserInfo

type UserInfo struct {
	// Uid login account id
	Username string `json:"username"`
	Password string `json:"password"`
}

func GetUserInfoFromConfigMap

func GetUserInfoFromConfigMap(username string) (UserInfo, error)

Jump to

Keyboard shortcuts

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