model

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobInfoTimeFormat = "2006-01-02 15:04:05"
)
View Source
const WorkspaceKubeDLLabel = "kubedl.io/workspace-name"
View Source
const WorkspacePrefix = "workspace-"

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 HistoryNotebookStatistic added in v0.4.2

type HistoryNotebookStatistic struct {
	// UserName can be NotebookUserName in NotebookInfo
	// or "Anonymous" if NotebookUserName is empty.
	UserName string `json:"userName"`

	// Total Notebook count submitted by this user.
	NotebookCount int32 `json:"NotebookCount"`

	// Notebook ratio submitted by this user.
	NotebookRatio float64 `json:"NotebookRatio"`
}

HistoryNotebookStatistic used to record history Notebook 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 NotebookInfo added in v0.4.2

type NotebookInfo struct {
	// Id: unique id
	Id string `json:"id"`
	// Name: Notebook name
	Name string `json:"name"`

	// status of Notebook
	NotebookStatus string `json:"notebookStatus"`

	// url to the notebook
	Url string `json:"url"`

	// Namespace where the notebook instance is
	Namespace string `json:"namespace"`

	CreateTime string `json:"createTime"`

	EndTime string `json:"endTime"`

	DurationTime string `json:"durationTime"`

	DeployRegion string `json:"deployRegion"`

	NotebookConfig string `json:"notebookConfig,omitempty"`

	UserName string `json:"userName,omitempty"`

	NotebookResource NotebookResource `json:"notebookResource,omitempty"`
}

NotebookInfo for the http request

func ConvertDMONotebookToNotebookInfo added in v0.4.2

func ConvertDMONotebookToNotebookInfo(dmoNotebook *dmo.Notebook) NotebookInfo

type NotebookResource added in v0.4.2

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

type NotebookStatistics added in v0.4.2

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

	// Total Notebook count submmitted from startTime to endTime.
	TotalNotebookCount int32 `json:"totalNotebookCount"`

	// Statistics of history Notebooks (All status), group by user.
	HistoryNotebooks []*HistoryNotebookStatistic `json:"historyNotebooks"`
}

NotebookStatistics used to record Notebook statistics submitted by users in current cluster.

type PodSpec added in v0.4.2

type PodSpec struct {
	Name  string `json:"name"`
	PodId string `json:"podId"`

	//
	ContainerIp string `json:"containerIp"`
	//
	ContainerId string `json:"containerId"`
	//
	HostIp string `json:"hostIp"`
	//
	Status corev1.PodPhase `json:"podStatus"`
	//
	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"`
}

PodSpec for Notebook

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)

type WorkspaceInfo added in v0.4.2

type WorkspaceInfo struct {
	Username string `json:"username"`

	Namespace string `json:"namespace"`

	CPU int64 `json:"cpu"`

	Memory int64 `json:"memory"`

	GPU int64 `json:"gpu"`

	Storage int64 `json:"storage"`

	Name string `json:"name"`

	Type string `json:"type"`

	PvcName string `json:"pvc_name"`

	// Created
	// Ready: pvc bound
	Status string `json:"status"`

	LocalPath string `json:"local_path"`

	Description string `json:"description"`

	CreateTime string `json:"create_time"`

	UpdateTime string `json:"update_time"`

	DurationTime string `json:"duration_time"`
}

WorkspaceInfo is the object returned in http call

Jump to

Keyboard shortcuts

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