handlers

package
Version: 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: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodesourceConfigMapName = "kubedl-codesource-config"
	CodesourceConfigMapKey  = "codesource"
)
View Source
const (
	ResourceGPU   = "nvidia.com/gpu"
	IndexNodeName = "spec.nodeName"
	IndexPhase    = "status.phase"
	GPUType       = "aliyun.accelerator/nvidia_name"
)
View Source
const (
	DatasourceConfigMapName = "kubedl-datasource-config"
	DatasourceConfigMapKey  = "datasource"
)

Variables

This section is empty.

Functions

func Int32

func Int32(v int32) *int32

Int32 is a helper routine that allocates a new int32 value to store v and returns a pointer to it.

Types

type CodeSourceHandler

type CodeSourceHandler struct {
	// contains filtered or unexported fields
}

func NewCodeSourceHandler

func NewCodeSourceHandler() *CodeSourceHandler

func (*CodeSourceHandler) DeleteCodeSourceFromConfigMap

func (ov *CodeSourceHandler) DeleteCodeSourceFromConfigMap(name string) error

delete

func (*CodeSourceHandler) GetCodeSourceFromConfigMap

func (ov *CodeSourceHandler) GetCodeSourceFromConfigMap(name string) (model.CodeSource, error)

get

func (*CodeSourceHandler) ListCodeSourceFromConfigMap

func (ov *CodeSourceHandler) ListCodeSourceFromConfigMap() (model.CodeSourceMap, error)

get all

func (*CodeSourceHandler) PostCodeSourceToConfigMap

func (ov *CodeSourceHandler) PostCodeSourceToConfigMap(codeSource model.CodeSource) error

post

func (*CodeSourceHandler) PutCodeSourceToConfigMap

func (ov *CodeSourceHandler) PutCodeSourceToConfigMap(codeSource model.CodeSource) error

put

type DataHandler

type DataHandler struct {
	// contains filtered or unexported fields
}

func NewDataHandler

func NewDataHandler() *DataHandler

func (*DataHandler) GetClusterNodeInfos

func (ov *DataHandler) GetClusterNodeInfos() (model.ClusterNodeInfoList, error)

GetClusterNodeInfos sum all pods allocatable and request resource(cpu/memory/gpu) in a node

func (*DataHandler) GetClusterRequestResource

func (ov *DataHandler) GetClusterRequestResource(podPhase string) (model.ClusterRequestResource, error)

GetClusterRequestResource sum all pods request resource(cpu/memory/gpu)

func (*DataHandler) GetClusterTotalResource

func (ov *DataHandler) GetClusterTotalResource() (model.ClusterTotalResource, error)

GetClusterTotalResource sum all nodes allocatable resource(cpu/memory/gpu)

type DataSourceHandler

type DataSourceHandler struct {
	// contains filtered or unexported fields
}

func NewDataSourceHandler

func NewDataSourceHandler() *DataSourceHandler

func (*DataSourceHandler) DeleteDataSourceFromConfigMap

func (ov *DataSourceHandler) DeleteDataSourceFromConfigMap(name string) error

delete

func (*DataSourceHandler) GetDataSourceFromConfigMap

func (ov *DataSourceHandler) GetDataSourceFromConfigMap(name string) (model.DataSource, error)

get

func (*DataSourceHandler) ListDataSourceFromConfigMap

func (ov *DataSourceHandler) ListDataSourceFromConfigMap() (model.DataSourceMap, error)

get all

func (*DataSourceHandler) PostDataSourceToConfigMap

func (ov *DataSourceHandler) PostDataSourceToConfigMap(dataSource model.DataSource) error

post

func (*DataSourceHandler) PutDataSourceToConfigMap

func (ov *DataSourceHandler) PutDataSourceToConfigMap(dataSource model.DataSource) error

put

type ImageConfig

type ImageConfig struct {
	TFCpuImages      []string `json:"tf-cpu-images"`
	TFGpuImages      []string `json:"tf-gpu-images"`
	PytorchGpuImages []string `json:"pytorch-gpu-images"`
	NotebookImages   []string `json:"notebook-images"`
}

ImageConfig contains the image for jobs and notebooks

type JobHandler

type JobHandler struct {
	// contains filtered or unexported fields
}

func NewJobHandler

func NewJobHandler(objBackend backends.ObjectStorageBackend, logHandler *LogHandler) *JobHandler

func (*JobHandler) DeleteJobFromBackend

func (jh *JobHandler) DeleteJobFromBackend(ns, name, jobID, kind, region string) error

func (*JobHandler) GetDetailedJobFromBackend

func (jh *JobHandler) GetDetailedJobFromBackend(ns, name, jobID, kind, region string) (model.JobInfo, error)

func (*JobHandler) GetJobJsonData

func (jh *JobHandler) GetJobJsonData(ns, name, kind string) ([]byte, error)

func (*JobHandler) GetJobStatisticsFromBackend

func (jh *JobHandler) GetJobStatisticsFromBackend(query *backends.Query) (model.JobStatistics, error)

func (*JobHandler) GetJobYamlData

func (jh *JobHandler) GetJobYamlData(ns, name, kind string) ([]byte, error)

func (*JobHandler) GetRunningJobsFromBackend

func (jh *JobHandler) GetRunningJobsFromBackend(query *backends.Query) ([]model.JobInfo, error)

func (*JobHandler) ListJobsFromBackend

func (jh *JobHandler) ListJobsFromBackend(query *backends.Query) ([]model.JobInfo, error)

func (*JobHandler) ListPVC

func (jh *JobHandler) ListPVC(ns string) ([]string, error)

func (*JobHandler) StopJobFromBackend

func (jh *JobHandler) StopJobFromBackend(ns, name, jobID, kind, region string) error

func (*JobHandler) SubmitJobWithKind

func (jh *JobHandler) SubmitJobWithKind(data []byte, kind string) error

type KubeDLHandler

type KubeDLHandler struct {
	// contains filtered or unexported fields
}

func NewKubeDLHandler

func NewKubeDLHandler() *KubeDLHandler

func (*KubeDLHandler) DetectJobsInNS

func (h *KubeDLHandler) DetectJobsInNS(ns, kind string) bool

func (*KubeDLHandler) GetImageConfig

func (h *KubeDLHandler) GetImageConfig() *ImageConfig

func (*KubeDLHandler) ListAvailableNamespaces

func (h *KubeDLHandler) ListAvailableNamespaces() ([]string, *v1.NamespaceList, error)

type LogHandler

type LogHandler struct {
	// contains filtered or unexported fields
}

func NewLogHandler

func NewLogHandler(eventStorage string) (*LogHandler, error)

func (*LogHandler) DownloadLogs

func (lh *LogHandler) DownloadLogs(namespace, podName, uid string, from, to time.Time) ([]byte, error)

func (*LogHandler) GetEvents

func (lh *LogHandler) GetEvents(namespace, objName, uid string, from, to time.Time) ([]string, error)

func (*LogHandler) GetLogs

func (lh *LogHandler) GetLogs(namespace, podName, uid string, from, to time.Time) ([]string, error)

type NotebookHandler added in v0.4.2

type NotebookHandler struct {
	// contains filtered or unexported fields
}

NotebookHandler handles the request for notebook

func NewNotebookHandler added in v0.4.2

func NewNotebookHandler(objStorage backends.ObjectStorageBackend) *NotebookHandler

func (*NotebookHandler) DeleteNotebookFromBackend added in v0.4.2

func (nh *NotebookHandler) DeleteNotebookFromBackend(ns, name, notebookID, region string) error

func (*NotebookHandler) GetJsonData added in v0.4.2

func (nh *NotebookHandler) GetJsonData(ns, name, kind string) ([]byte, error)

func (*NotebookHandler) GetYamlData added in v0.4.2

func (nh *NotebookHandler) GetYamlData(ns, name, kind string) ([]byte, error)

func (*NotebookHandler) ListNotebooksFromBackend added in v0.4.2

func (nh *NotebookHandler) ListNotebooksFromBackend(query *backends.NotebookQuery) ([]model.NotebookInfo, error)

func (*NotebookHandler) SubmitNotebook added in v0.4.2

func (nh *NotebookHandler) SubmitNotebook(data []byte) error

type TensorBoardHandler

type TensorBoardHandler struct {
	// contains filtered or unexported fields
}

func NewTensorBoardHandler

func NewTensorBoardHandler() *TensorBoardHandler

func (*TensorBoardHandler) ApplyNewTensorBoardConfig

func (th *TensorBoardHandler) ApplyNewTensorBoardConfig(jobNamespace, jobName, kind string, config tensorboard.TensorBoard) error

func (*TensorBoardHandler) GetJob

func (th *TensorBoardHandler) GetJob(jobNamespace, jobName, kind string) (metav1.Object, error)

func (*TensorBoardHandler) GetTensorBoardInstance

func (th *TensorBoardHandler) GetTensorBoardInstance(jobNamespace, jobName, jobUID string) (*v1.Pod, error)

func (*TensorBoardHandler) ListIngressInstances

func (th *TensorBoardHandler) ListIngressInstances(jobNamespace, jobName, jobUID string) ([]*networkingv1.Ingress, error)

Jump to

Keyboard shortcuts

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