types

package
v0.0.0-...-6b04d54 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IfNotPresent : Constant string
	IfNotPresent = "IfNotPresent"

	// Always : Constant
	Always = "Always"

	// OnFailure : Constant
	OnFailure = "OnFailure"

	// Notebook : PodType Notebook
	Notebook = "Notebook"

	// Lab : PodType LAB
	Lab = "Lab"

	// JobTypeNotebook : Job type of Notebook
	JobTypeNotebook = "Notebook"

	// JobTypeLab : Job type of LAB
	JobTypeLab = "Lab"

	// JobTypeSchedNotebook : Job type of scheduled notebook
	JobTypeSchedNotebook = "Scheduled Notebook"

	// JobTypeDefault : Default Job type if not Notebook or Lab
	JobTypeDefault = "Default"

	// PodReqModeSch : Pod Request Mode
	PodReqModeSch PodRequestMode = 1

	// PodReqModeImd : Pod Request Mode
	PodReqModeImd PodRequestMode = 2

	// PodReqModeBck : Pod Request Mode Background
	PodReqModeBck PodRequestMode = 3

	// DefaultExternalPort :
	DefaultExternalPort = 80

	// DefaultAppPort :
	DefaultAppPort = 8888

	// PodStatusUnknown : POD in Unknown Status
	PodStatusUnknown PodStatus = 0

	// PodReqScheduled :
	PodReqScheduled PodStatus = 10

	// PodRequested :
	PodRequested PodStatus = 100

	// PodReqInvalid :
	PodReqInvalid PodStatus = 200

	// PodReqInitiating :
	PodReqInitiating PodStatus = 300

	// PodReqInitiated :
	PodReqInitiated PodStatus = 400

	// PodReqInitiatedDeploy :
	PodReqInitiatedDeploy PodStatus = 410

	// PodReqServiceInitiated :
	PodReqServiceInitiated PodStatus = 420

	// PodReqIngressInitiated :
	PodReqIngressInitiated PodStatus = 430

	// PodReqCancelled :
	PodReqCancelled PodStatus = 500

	// PodInitiating :
	PodInitiating PodStatus = 600

	// PodRestarting :
	PodRestarting PodStatus = 700

	// PodRunning :
	PodRunning PodStatus = 1000

	// PodInit :
	PodInit PodStatus = 1100

	//PodDestroy :
	PodDestroy PodStatus = 1200

	// PodFailing :
	PodFailing PodStatus = 2000

	// PodCompleted :
	PodCompleted PodStatus = 2100

	// PodShuttingDown :
	PodShuttingDown PodStatus = 2200

	// PodTerminated :
	PodTerminated PodStatus = 2300

	// PodReqFailed :
	PodReqFailed PodStatus = 3000

	// PodInitFailed :
	PodInitFailed PodStatus = 3100

	// PodDestroyFailed :
	PodDestroyFailed PodStatus = 3200

	// PodRuntimeFailure :
	PodRuntimeFailure PodStatus = 3300

	// PodApplicationError :
	PodApplicationError PodStatus = 3400

	// PhaseScheduled :
	PhaseScheduled = 5

	// PhasePending :
	PhasePending = 10

	// PhaseRunning :
	PhaseRunning = 20

	// PhaseShutdown :
	PhaseShutdown = 40

	// PhaseFailed :
	PhaseFailed = 50

	// PhaseUnknown :
	PhaseUnknown = 0
)
View Source
const (
	// SessionValid :
	SessionValid = "Valid"
	// SessionInvalid :
	SessionInvalid = "Invalid"
	// SessionStale :
	SessionStale = "Stale"
)
View Source
const GuestUserName = "admin"

GuestUserName : Guest user name used in server auth is disabled

View Source
const (

	// OutPathPostfix : Output path post fix for notebook jobs
	OutPathPostfix = "_out"
)

Variables

This section is empty.

Functions

func IsValidResourceProfile

func IsValidResourceProfile(p *ResourceProfile) bool

IsValidResourceProfile : Is valid resource profile?

func PodPhaseDesc

func PodPhaseDesc(code PodPhase) string

PodPhaseDesc : Returns meaning for a phase code

func PodStatusDesc

func PodStatusDesc(code PodStatus) string

PodStatusDesc : Returns meaning for a phase code

Types

type ContainerImage

type ContainerImage struct {
	ID          uint64
	Name        string
	Disabled    bool
	RegistryURL string
	DescText    string
	DescHTML    string
}

ContainerImage : Container images

type ContainerImages

type ContainerImages []ContainerImage

ContainerImages : List of container images

type EnvVar

type EnvVar struct {
	Name  string
	Value string
}

EnvVar : List of OS environment vars

type POD

type POD struct {
	ID          uint64
	Name        string
	PodType     string // NB for notebook, LAB for jupyter lab
	RequestMode PodRequestMode
	CreatedBy   *User
	AuthToken   string

	// User Key is reference used for identifying the pod by user
	UserKey     string
	ServiceName string
	ServicePort int32

	Config *PODConfig
	Phase  PodPhase
	Status PodStatus

	Started       time.Time
	Ended         time.Time
	Created       time.Time
	Updated       time.Time
	Failed        time.Time
	Cancelled     time.Time
	FailureReason string
	Endpoint      string
	Result        string
}

POD :

func NewPOD

func NewPOD(user *User, jobType string, requestMode PodRequestMode, c *PODConfig) *POD

NewPOD :

func (*POD) GetID

func (p *POD) GetID() uint64

GetID : Returns POD ID

func (*POD) IsDone

func (p *POD) IsDone() bool

IsDone : Returns true if pod has not ended yet

func (*POD) IsPending

func (p *POD) IsPending() bool

IsPending : returns true if POD has not started yet

func (*POD) SetRequestMode

func (p *POD) SetRequestMode(m PodRequestMode)

SetRequestMode : Sets POD request Mode

func (*POD) SetStatus

func (p *POD) SetStatus(s PodStatus, err error)

SetStatus :

func (*POD) Terminate

func (p *POD) Terminate()

Terminate : Initiate terminate status on POD

type PODConfig

type PODConfig struct {
	*PODParams
	Resources       *ResourceProfile
	Image           *ContainerImage
	ImagePullPolicy string
	Command         string
	AppPort         uint16
	ExternalPort    uint16
	EnvVars         []*EnvVar
	PythonLibs      []*PythonLib
	Disk            *PersistentDisk
	RestartPolicy   string
}

PODConfig : represents a compute pod launched for notebooks

func NewPODConfig

func NewPODConfig(rp *ResourceProfile, ci *ContainerImage, cmd string, dsk *PersistentDisk, params *PODParams) (*PODConfig, error)

NewPODConfig : New POD Config

type PODParams

type PODParams struct {

	// Input Notebook for scheduled / background notebooks
	InputPath string

	// Workspace Path (mostly s3 prefixed) to fetch s3 contents in the POD
	WorkspacePath string

	// Local Path where workspace contents need to be mounted
	MountPath string

	// Notebook output. Usually a notebook too
	OutputPath string

	// Persistent Disk host path in case volume persistence is enabled
	PersDiskHostPath string

	// Access / Secret key for saving or retrieving notebooks from s3
	// TODO: store in vault
	AwsAccessKey string
	AwsSecretKey string
}

PODParams : Additional Parameters for running job pods

func NewPodParams

func NewPodParams(inputpath, wspath, mountpath, outpath string) *PODParams

NewPodParams : Returns a new PodParams struct

type PersistentDisk

type PersistentDisk struct {
	Name     string
	HostPath string
	Size     uint64
}

PersistentDisk : Represents Persistent Disks / Volumes

type PodPhase

type PodPhase int

PodPhase : determines the current phase of POD

type PodRequestMode

type PodRequestMode int

PodRequestMode : Pod Request Mode; can be Immediate or Scheduled

type PodStatus

type PodStatus int

PodStatus : determines the state of POD. depends on phase

type PythonLib

type PythonLib struct {
	Name     string
	DescText string
	DescHTML string
}

PythonLib : Name of the libraries that need to be installed

type PythonLibs

type PythonLibs []PythonLib

PythonLibs : List of python libs

type ResourceGroup

type ResourceGroup struct {
	ID               uint64
	Name             string
	ResourceProfiles []*ResourceProfile
}

ResourceGroup : Resource Profile group

type ResourceProfile

type ResourceProfile struct {
	ID        uint64
	Name      string
	Disabled  bool
	Subtitle  string
	ShortDesc string
	LongDesc  string
	CPU       string
	GPU       string
	GPURam    string
	RAM       string
	Disk      string
}

ResourceProfile : Resource Plans

type ResourceProfiles

type ResourceProfiles []ResourceProfile

ResourceProfiles : List of resource plans

type Session

type Session struct {
	ID uint64
	*User
	JWT string
}

Session :

func NewSession

func NewSession(id uint64, jwt string, userAttrs *UserAttrs) *Session

NewSession :

type SessionAttrs

type SessionAttrs struct {
	ID          uint64
	Session     *Session
	Created     time.Time
	LastConnect time.Time
	Destroyed   time.Time
	Status      SessionStatus
}

SessionAttrs : not used yet

func NewSessionAttrs

func NewSessionAttrs(session *Session) *SessionAttrs

NewSessionAttrs :

type SessionStatus

type SessionStatus string

SessionStatus :

type User

type User struct {
	Name string
}

User : User Object

type UserAttrs

type UserAttrs struct {
	*User
	Email        string
	PasswordHash string
	Status       UserStatus
	Type         UserType
	APIKey       string
}

UserAttrs : User attrbutes table

type UserPOD

type UserPOD struct {
	POD
	User *User
}

UserPOD : holds user pods

type UserPersistentDisk

type UserPersistentDisk struct {
	User *User
	Disk *PersistentDisk
}

UserPersistentDisk : User specific disk / pv details

type UserStatus

type UserStatus string

UserStatus : User status message

type UserType

type UserType string

UserType : Standard, Guest or Admin

const (
	// ValidUser : lookup key val
	ValidUser = "Valid"
	// InvalidUser : lookup key val
	InvalidUser = "Invalid"

	// GuestUser : lookup key val
	GuestUser UserType = "Guest"

	// StandardUser : lookup key val
	StandardUser UserType = "Standard"

	// AdminUser : user type
	AdminUser UserType = "Admin"
)

Jump to

Keyboard shortcuts

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