v1

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterApi         = Prefix + "/cluster"
	KeyMarker          = "marker"
	KeyMaxKeys         = "maxKeys"
	KeyClusterNameList = "clusterNames"
	KeyClusterStatus   = "clusterStatus"
)
View Source
const (
	FsApi       = Prefix + "/fs"
	KeyUsername = "username"
)
View Source
const (
	JobApi          = Prefix + "/job"
	TypeSingle      = "single"
	TypeDistributed = "distributed"
	TypeWorkflow    = "workflow"
	KeyAction       = "action"
	KeyStatus       = "status"
	KeyTimestamp    = "timestamp"
	KeyStartTime    = "startTime"
	KeyQueue        = "queue"
	KeyLabels       = "labels"
)
View Source
const (
	QueueApi = Prefix + "/queue"
	KeyName  = "name"
)
View Source
const (
	Prefix   = util.PaddleflowRouterPrefix + util.PaddleflowRouterVersionV1
	LoginApi = Prefix + "/login"
)
View Source
const (
	FlavourAPI = Prefix + "/flavour"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIV1Client

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

APIV1Client is used to interact with features provided by the group.

func NewForConfig

func NewForConfig(config *core.PaddleFlowClientConfiguration) (*APIV1Client, error)

func (*APIV1Client) Cluster

func (c *APIV1Client) Cluster() ClusterInterface

func (*APIV1Client) FileSystem

func (c *APIV1Client) FileSystem() FileSystemInterface

func (*APIV1Client) Flavour added in v0.14.3

func (c *APIV1Client) Flavour() FlavourInterface

func (*APIV1Client) Job

func (c *APIV1Client) Job() JobInterface

func (*APIV1Client) Queue

func (c *APIV1Client) Queue() QueueInterface

func (*APIV1Client) RESTClient

func (c *APIV1Client) RESTClient() *core.PaddleFlowClient

RESTClient returns a RESTClient that is used to communicate with API server by this client implementation.

func (*APIV1Client) User

func (c *APIV1Client) User() UserInterface

type ClusterCommonInfo added in v0.14.3

type ClusterCommonInfo struct {
	ID            string   `json:"clusterId"`     // 集群id
	Description   string   `json:"description"`   // 集群描述
	Endpoint      string   `json:"endpoint"`      // 集群endpoint, 比如 http://10.11.11.47:8080
	Source        string   `json:"source"`        // 来源, 比如 OnPremise (内部部署)、AWS、CCE
	ClusterType   string   `json:"clusterType"`   // 集群类型,比如kubernetes/local/yarn
	Version       string   `json:"version"`       // 集群版本v1.16
	Status        string   `json:"status"`        // 集群状态,可选值为online, offline
	Credential    string   `json:"credential"`    // 用于存储集群的凭证信息,比如k8s的kube_config配置
	Setting       string   `json:"setting"`       // 存储额外配置信息
	NamespaceList []string `json:"namespaceList"` // 命名空间列表,json类型,如["ns1", "ns2"]
}

type ClusterGetter

type ClusterGetter interface {
	Cluster() ClusterInterface
}

type ClusterInfo added in v0.14.3

type ClusterInfo struct {
	ID               string
	CreatedAt        time.Time
	UpdatedAt        time.Time
	Name             string   `json:"clusterName"`   // 集群名字
	Description      string   `json:"description"`   // 集群描述
	Endpoint         string   `json:"endpoint"`      // 集群endpoint, 比如 http://10.11.11.47:8080
	Source           string   `json:"source"`        // 来源, 比如 OnPremise (内部部署)、AWS、CCE
	ClusterType      string   `json:"clusterType"`   // 集群类型,比如Kubernetes/Local
	Version          string   `json:"version"`       // 集群版本,比如v1.16
	Status           string   `json:"status"`        // 集群状态,可选值为online, offline
	Credential       string   `json:"credential"`    // 用于存储集群的凭证信息,比如k8s的kube_config配置
	Setting          string   `json:"setting"`       // 存储额外配置信息
	RawNamespaceList string   `json:"-"`             // 命名空间列表,json类型,如["ns1", "ns2"]
	NamespaceList    []string `json:"namespaceList"` // 命名空间列表,json类型,如["ns1", "ns2"]
	DeletedAt        string   `json:"-"`             // 删除标识,非空表示软删除
}

type ClusterInterface

type ClusterInterface interface {
	Create(ctx context.Context, request *CreateClusterRequest, token string) (*CreateClusterResponse, error)
	Get(ctx context.Context, clusterName string, token string) (*GetClusterResponse, error)
	List(ctx context.Context, request *ListClusterRequest, token string) (*ListClusterResponse, error)
	Update(ctx context.Context, clusterName string, request *UpdateClusterRequest, token string) (*UpdateClusterResponse, error)
	Delete(ctx context.Context, clusterName string, token string) error
}

type CommonJobInfo added in v0.14.3

type CommonJobInfo struct {
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	Labels           map[string]string `json:"labels"`
	Annotations      map[string]string `json:"annotations"`
	SchedulingPolicy SchedulingPolicy  `json:"schedulingPolicy"`
	UserName         string            `json:",omitempty"`
}

CommonJobInfo the common fields for jobs

type CreateClusterRequest added in v0.14.3

type CreateClusterRequest struct {
	ClusterCommonInfo
	Name string `json:"clusterName"` // 集群名字
}

type CreateClusterResponse added in v0.14.3

type CreateClusterResponse struct {
	ID               string
	CreatedAt        time.Time
	UpdatedAt        time.Time
	Name             string   // 集群名字
	Description      string   // 集群描述
	Endpoint         string   // 集群endpoint, 比如 http://10.11.11.47:8080
	Source           string   // 来源, 比如 OnPremise (内部部署)、AWS、CCE
	ClusterType      string   // 集群类型,比如Kubernetes/Local
	Version          string   // 集群版本,比如v1.16
	Status           string   // 集群状态,可选值为online, offline
	Credential       string   // 用于存储集群的凭证信息,比如k8s的kube_config配置
	Setting          string   // 存储额外配置信息
	RawNamespaceList string   // 命名空间列表,json类型,如["ns1", "ns2"]
	NamespaceList    []string // 命名空间列表,json类型,如["ns1", "ns2"]
	DeletedAt        string   // 删除标识,非空表示软删除
}

type CreateDisJobRequest added in v0.14.3

type CreateDisJobRequest struct {
	CommonJobInfo     `json:",inline"`
	Framework         schema.Framework       `json:"framework"`
	Members           []MemberSpec           `json:"members"`
	ExtensionTemplate map[string]interface{} `json:"extensionTemplate"`
}

CreateDisJobRequest convey request for create distributed job

type CreateFileSystemRequest added in v0.14.3

type CreateFileSystemRequest struct {
	Name       string            `json:"name"`
	Url        string            `json:"url"`
	Properties map[string]string `json:"properties"`
	Username   string            `json:"username"`
}

type CreateFileSystemResponse added in v0.14.3

type CreateFileSystemResponse struct {
	FsName string `json:"fsName"`
	FsID   string `json:"fsID"`
}

type CreateFlavourRequest added in v0.14.3

type CreateFlavourRequest struct {
	Name            string                     `json:"name"`
	CPU             string                     `json:"cpu"`
	Mem             string                     `json:"mem"`
	ScalarResources schema.ScalarResourcesType `json:"scalarResources,omitempty"`
}

CreateFlavourRequest convey request for create flavour

type CreateFlavourResponse added in v0.14.3

type CreateFlavourResponse struct {
	FlavourName string `json:"name"`
}

CreateFlavourResponse convey response for create flavour

type CreateJobResponse added in v0.14.3

type CreateJobResponse struct {
	ID string `json:"id"`
}

CreateJobResponse convey response for create job

type CreateQueueRequest added in v0.14.3

type CreateQueueRequest struct {
	Name         string              `json:"name"`
	Namespace    string              `json:"namespace"`
	ClusterName  string              `json:"clusterName"`
	QuotaType    string              `json:"quotaType"`
	MaxResources schema.ResourceInfo `json:"maxResources"`
	MinResources schema.ResourceInfo `json:"minResources"`
	Location     map[string]string   `json:"location"`
	// 任务调度策略
	SchedulingPolicy []string `json:"schedulingPolicy,omitempty"`
	Status           string   `json:"-"`
}

type CreateQueueResponse added in v0.14.3

type CreateQueueResponse struct {
	QueueName string `json:"name"`
}

type CreateSingleJobRequest added in v0.14.3

type CreateSingleJobRequest struct {
	CommonJobInfo `json:",inline"`
	JobSpec       `json:",inline"`
}

CreateSingleJobRequest convey request for create job

type CreateWfJobRequest added in v0.14.3

type CreateWfJobRequest struct {
	CommonJobInfo     `json:",inline"`
	Framework         schema.Framework       `json:"framework"`
	Members           []MemberSpec           `json:"members"`
	ExtensionTemplate map[string]interface{} `json:"extensionTemplate"`
}

CreateWfJobRequest convey request for create workflow job

type DeleteFileSystemRequest added in v0.14.3

type DeleteFileSystemRequest struct {
	FsName   string `json:"fsName"`
	Username string `json:"username"`
}

type DistributedJobSpec added in v0.14.3

type DistributedJobSpec struct {
	Framework schema.Framework `json:"framework,omitempty"`
	Members   []Member         `json:"members,omitempty"`
}

type DistributedRuntimeInfo added in v0.14.3

type DistributedRuntimeInfo struct {
	Name      string        `json:"name,omitempty"`
	Namespace string        `json:"namespace,omitempty"`
	ID        string        `json:"id,omitempty"`
	Status    string        `json:"status,omitempty"`
	Runtimes  []RuntimeInfo `json:"runtimes,omitempty"`
}

type FileSystemGetter

type FileSystemGetter interface {
	FileSystem() FileSystemInterface
}

type FileSystemInterface

type FileSystemInterface interface {
	Create(ctx context.Context, request *CreateFileSystemRequest, token string) (*CreateFileSystemResponse, error)
	Get(ctx context.Context, request *GetFileSystemRequest, token string) (*GetFileSystemResponse, error)
	Delete(ctx context.Context, request *DeleteFileSystemRequest, token string) error
}

type Flavour added in v0.14.3

type Flavour struct {
	ID                 string                     `json:"id"`
	CreatedAt          time.Time                  `json:"-"`
	UpdatedAt          time.Time                  `json:"-"`
	Pk                 int64                      `json:"-"           gorm:"primaryKey;autoIncrement"`
	Name               string                     `json:"name"        gorm:"uniqueIndex"`
	ClusterID          string                     `json:"-" gorm:"column:cluster_id;default:''"`
	ClusterName        string                     `json:"-" gorm:"column:cluster_name;->"`
	CPU                string                     `json:"cpu"         gorm:"column:cpu"`
	Mem                string                     `json:"mem"         gorm:"column:mem"`
	RawScalarResources string                     `json:"-"           gorm:"column:scalar_resources;type:text;default:'{}'"`
	ScalarResources    schema.ScalarResourcesType `json:"scalarResources" gorm:"-"`
	UserName           string                     `json:"-" gorm:"column:user_name"`
	DeletedAt          gorm.DeletedAt             `json:"-" gorm:"index"`
}

type FlavourGetter added in v0.14.3

type FlavourGetter interface {
	Flavour() FlavourInterface
}

type FlavourInterface added in v0.14.3

type FlavourInterface interface {
	Create(ctx context.Context, request *CreateFlavourRequest, token string) (*CreateFlavourResponse, error)
	Update(ctx context.Context, request *UpdateFlavourRequest, token string) (*UpdateFlavourResponse, error)
	Get(ctx context.Context, name string, token string) (*Flavour, error)
	List(ctx context.Context, request *ListFlavourRequest, token string) (*ListFlavourResponse, error)
	Delete(ctx context.Context, name string, token string) error
}

type GetClusterResponse added in v0.14.3

type GetClusterResponse struct {
	ClusterInfo
}

type GetFileSystemRequest added in v0.14.3

type GetFileSystemRequest struct {
	FsName   string `json:"fsName"`
	Username string `json:"username"`
}

type GetFileSystemResponse added in v0.14.3

type GetFileSystemResponse struct {
	Id            string            `json:"id"`
	Name          string            `json:"name"`
	ServerAddress string            `json:"serverAddress"`
	Type          string            `json:"type"`
	SubPath       string            `json:"subPath"`
	Username      string            `json:"username"`
	Properties    map[string]string `json:"properties"`
}

type GetJobResponse added in v0.14.3

type GetJobResponse struct {
	CreateSingleJobRequest `json:",inline"`
	DistributedJobSpec     `json:",inline"`
	Status                 string                  `json:"status"`
	Message                string                  `json:"message"`
	AcceptTime             string                  `json:"acceptTime"`
	StartTime              string                  `json:"startTime"`
	FinishTime             string                  `json:"finishTime"`
	Runtime                *RuntimeInfo            `json:"runtime,omitempty"`
	DistributedRuntime     *DistributedRuntimeInfo `json:"distributedRuntime,omitempty"`
	WorkflowRuntime        *WorkflowRuntimeInfo    `json:"workflowRuntime,omitempty"`
	UpdateTime             time.Time               `json:"-"`
}

type GetQueueResponse added in v0.14.3

type GetQueueResponse struct {
	Queue
}

type JobGetter

type JobGetter interface {
	Job() JobInterface
}

type JobInterface

type JobInterface interface {
	Create(ctx context.Context, single *CreateSingleJobRequest, distributed *CreateDisJobRequest,
		wf *CreateWfJobRequest, token string) (*CreateJobResponse, error)
	Get(ctx context.Context, jobID string, token string) (*GetJobResponse, error)
	List(ctx context.Context, request *ListJobRequest, token string) (*ListJobResponse, error)
	Update(ctx context.Context, jobID string, request *UpdateJobRequest, token string) error
	Stop(ctx context.Context, jobID string, token string) error
	Delete(ctx context.Context, jobID string, token string) error
}

type JobSpec added in v0.14.3

type JobSpec struct {
	Flavour           schema.Flavour         `json:"flavour"`
	FS                schema.FileSystem      `json:"fs"`
	ExtraFS           []schema.FileSystem    `json:"extraFS"`
	Image             string                 `json:"image"`
	Env               map[string]string      `json:"env"`
	Command           string                 `json:"command"`
	Args              []string               `json:"args"`
	Port              int                    `json:"port"`
	ExtensionTemplate map[string]interface{} `json:"extensionTemplate"`
}

JobSpec the spec fields for jobs

type ListClusterRequest added in v0.14.3

type ListClusterRequest struct {
	Marker          string   `json:"marker"`
	MaxKeys         int      `json:"maxKeys"`
	ClusterNameList []string `json:"clusterNameList"`
	ClusterStatus   string   `json:"clusterStatus"`
}

type ListClusterResponse added in v0.14.3

type ListClusterResponse struct {
	common.MarkerInfo
	ClusterList []ClusterInfo `json:"clusterList"`
}

type ListFlavourRequest added in v0.14.3

type ListFlavourRequest struct {
	ClusterName string `json:"clusterName,omitempty"`
	Name        string `json:"name"`
	Marker      string `json:"marker"`
	MaxKeys     int    `json:"maxKeys"`
}

type ListFlavourResponse added in v0.14.3

type ListFlavourResponse struct {
	common.MarkerInfo
	FlavourList []Flavour `json:"flavourList"`
}

ListFlavourResponse convey response for list flavour

type ListJobRequest added in v0.14.3

type ListJobRequest struct {
	Queue     string            `json:"queue,omitempty"`
	Status    string            `json:"status,omitempty"`
	Timestamp int64             `json:"timestamp,omitempty"`
	StartTime string            `json:"startTime,omitempty"`
	Labels    map[string]string `json:"labels,omitempty"`
	Marker    string            `json:"marker"`
	MaxKeys   int               `json:"maxKeys"`
}

type ListJobResponse added in v0.14.3

type ListJobResponse struct {
	common.MarkerInfo
	JobList []*GetJobResponse `json:"jobList"`
}

type ListQueueRequest added in v0.14.3

type ListQueueRequest struct {
	Marker    string
	MaxKeys   int
	QueueName string
}

type ListQueueResponse added in v0.14.3

type ListQueueResponse struct {
	common.MarkerInfo
	QueueList []Queue `json:"queueList"`
}

type LoginInfo added in v0.14.3

type LoginInfo struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse added in v0.14.3

type LoginResponse struct {
	Authorization string `json:"authorization"`
}

type Member added in v0.14.3

type Member struct {
	ID          string            `json:"id"`
	Replicas    int               `json:"replicas"`
	Role        schema.MemberRole `json:"role"`
	schema.Conf `json:",inline"`
}

type MemberSpec added in v0.14.3

type MemberSpec struct {
	CommonJobInfo `json:",inline"`
	JobSpec       `json:",inline"`
	Role          string `json:"role"`
	Replicas      int    `json:"replicas"`
}

type Queue added in v0.14.3

type Queue struct {
	ID              string              `json:"id"`
	CreatedAt       time.Time           `json:"-"`
	UpdatedAt       time.Time           `json:"-"`
	Name            string              `json:"name"`
	Namespace       string              `json:"namespace"`
	ClusterId       string              `json:"-"`
	ClusterName     string              `json:"clusterName"`
	QuotaType       string              `json:"quotaType"`
	RawMinResources string              `json:"-"`
	MinResources    schema.ResourceInfo `json:"minResources"`
	RawMaxResources string              `json:"-"`
	MaxResources    schema.ResourceInfo `json:"maxResources"`
	RawLocation     string              `json:"-"`
	Location        map[string]string   `json:"location"`
	// 任务调度策略
	RawSchedulingPolicy string   `json:"-"`
	SchedulingPolicy    []string `json:"schedulingPolicy,omitempty"`
	Status              string   `json:"status"`
}

type QueueGetter

type QueueGetter interface {
	Queue() QueueInterface
}

type QueueInterface

type QueueInterface interface {
	Create(ctx context.Context, request *CreateQueueRequest, token string) (*CreateQueueResponse, error)
	Get(ctx context.Context, queueName string, token string) (*GetQueueResponse, error)
	List(ctx context.Context, request *ListQueueRequest, token string) (*ListQueueResponse, error)
	Update(ctx context.Context, queueName string, request *UpdateQueueRequest, token string) (*UpdateQueueResponse, error)
	Delete(ctx context.Context, queueName string, token string) error
}

type RuntimeInfo added in v0.14.3

type RuntimeInfo struct {
	Name      string `json:"name,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	ID        string `json:"id,omitempty"`
	Status    string `json:"status,omitempty"`
}

type SchedulingPolicy added in v0.14.3

type SchedulingPolicy struct {
	Queue    string `json:"queue"`
	QueueID  string `json:"-"`
	Priority string `json:"priority,omitempty"`
}

SchedulingPolicy indicate queueID/priority

type UpdateClusterRequest added in v0.14.3

type UpdateClusterRequest struct {
	ClusterCommonInfo
}

type UpdateClusterResponse added in v0.14.3

type UpdateClusterResponse struct {
	ClusterInfo
}

type UpdateFlavourRequest added in v0.14.3

type UpdateFlavourRequest struct {
	Name            string                     `json:"-"`
	CPU             string                     `json:"cpu,omitempty"`
	Mem             string                     `json:"mem,omitempty"`
	ScalarResources schema.ScalarResourcesType `json:"scalarResources,omitempty"`
}

UpdateFlavourRequest convey request for update flavour

type UpdateFlavourResponse added in v0.14.3

type UpdateFlavourResponse struct {
	Flavour
}

UpdateFlavourResponse convey response for update flavour

type UpdateJobRequest added in v0.14.3

type UpdateJobRequest struct {
	JobID       string            `json:"-"`
	Priority    string            `json:"priority"`
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
}

type UpdateQueueRequest added in v0.14.3

type UpdateQueueRequest struct {
	Name         string              `json:"-"`
	Namespace    string              `json:"-"`
	ClusterName  string              `json:"-"`
	QuotaType    string              `json:"-"`
	MaxResources schema.ResourceInfo `json:"maxResources,omitempty"`
	MinResources schema.ResourceInfo `json:"minResources,omitempty"`
	Location     map[string]string   `json:"location,omitempty"`
	// 任务调度策略
	SchedulingPolicy []string `json:"schedulingPolicy,omitempty"`
	Status           string   `json:"-"`
}

type UpdateQueueResponse added in v0.14.3

type UpdateQueueResponse struct {
	Queue
}

type UserGetter

type UserGetter interface {
	User() UserInterface
}

type UserInterface

type UserInterface interface {
	Login(ctx context.Context, request *LoginInfo) (*LoginResponse, error)
}

type WorkflowRuntimeInfo added in v0.14.3

type WorkflowRuntimeInfo struct {
	Name      string                   `json:"name,omitempty"`
	Namespace string                   `json:"namespace,omitempty"`
	ID        string                   `json:"id,omitempty"`
	Status    string                   `json:"status,omitempty"`
	Nodes     []DistributedRuntimeInfo `json:"nodes,omitempty"`
}

Jump to

Keyboard shortcuts

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