Documentation
¶
Overview ¶
Package db defines data transfer obejects
Index ¶
- func BeginTransactions() *gorm.DB
- func Commit(tx *gorm.DB)
- func Enqueue(message string) error
- func GetCache(key string) ([]byte, error)
- func ImageError(owner, caption string, imageAction ImageAction, tag string, err error)
- func Initialize()
- func JobError(owner, caption string, jobAction JobAction, id string, err error)
- func OnlineError(owner, caption string, onlineAction OnlineAction, err error)
- func Ping() error
- func RemoveBuildingImage(name string) error
- func RemoveBuildingJobImagesJobs(id string) error
- func RemoveJob(id string) error
- func RemovePullingImage(name string) error
- func RemovePushingJobImageJobs(id string) error
- func Rollback(tx *gorm.DB)
- func SetCache(key string, value []byte, duration *time.Duration) error
- func SetupQueue(handler interface{}, fallbackHandler interface{})
- func Shutdown()
- func ShutdownCache()
- func ShutdownQueue()
- func UpdateJob(id string, from, to JobAction, status JobStatus, targetID *string) error
- type Error
- type Image
- type ImageAction
- type Job
- type JobAction
- type JobStatus
- type OnlineAction
- type PlatformType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImageError ¶
func ImageError(owner, caption string, imageAction ImageAction, tag string, err error)
ImageError persists an image error
func OnlineError ¶
func OnlineError(owner, caption string, onlineAction OnlineAction, err error)
OnlineError persists an online error
func Ping ¶
func Ping() error
Ping verifies a connection to the database is still alive, establishing a connection if necessary.
func RemoveBuildingImage ¶
RemoveBuildingImage removes from BUILDING cache
func RemoveBuildingJobImagesJobs ¶
RemoveBuildingJobImagesJobs removes job
func RemovePullingImage ¶
RemovePullingImage removes from PULLING cache
func RemovePushingJobImageJobs ¶
RemovePushingJobImageJobs removes job
func SetupQueue ¶
func SetupQueue(handler interface{}, fallbackHandler interface{})
SetupQueue start its service
Types ¶
type Error ¶
type Error struct {
gorm.Model
Owner string `gorm:"index:owner;"`
Caption string `gorm:"column:caption;"`
ErrorMessage *string `gorm:"column:error_detail;"`
OnlineAction *string `gorm:"column:online_action;"`
ImageAction *string `gorm:"column:image_action;"`
ImageTag *string `gorm:"column:image_tag;"`
JobAction *string `gorm:"column:job_action;"`
JobID *string `gorm:"column:job_id;"`
}
Error represents error information
type Image ¶
type Image struct {
gorm.Model
Tag string `gorm:"index:tag;"`
Action string `gorm:"index:action;"`
Owner string
}
Image represents cached image information
func FindImages ¶
func FindImages(action ImageAction) ([]*Image, error)
FindImages search images based on the ImageType
type ImageAction ¶
type ImageAction string
ImageAction defines how handle a image
const ( ImageActionPulling ImageAction = "pulling" ImageActionBuilding ImageAction = "building" )
ImageActions
type Job ¶
type Job struct {
gorm.Model
JobID string `gorm:"column:job_id;index:jobid;"`
Action string `gorm:"index:action;"`
Platform int
Status string
DockerImage string `gorm:"column:docker_image;"`
PythonFile string `gorm:"column:python_file;"`
Workspaces string
Commands string
CPU int64
Memory int64
GPU int64
CoreType string `gorm:"column:core_type;"`
Cores int64
TargetID string `gorm:"column:target_id;"` // Job ID of the target platform
}
Job represents cached job information
type JobStatus ¶
type JobStatus string
JobStatus defines the status of a job
const ( JobStatusImageBuilding JobStatus = "building" JobStatusImagePushing JobStatus = "pushing" JobStatusK8sInit JobStatus = "k8s-job-init" // Kubernetes JobStatusK8sStarted JobStatus = "k8s-job-started" JobStatusK8sPending JobStatus = "k8s-job-pending" JobStatusK8sRunning JobStatus = "k8s-job-runnning" JobStatusK8sSucceeded JobStatus = "k8s-job-succeeded" JobStatusK8sFailed JobStatus = "k8s-job-failed" JobStatusRescaleSend JobStatus = "rescale-send" // Rescale JobStatusRescaleStarted JobStatus = "rescale-start" JobStatusRescaleRunning JobStatus = "rescale-runnning" JobStatusRescaleSucceed JobStatus = "rescale-succeeded" JobStatusRescaleFailed JobStatus = "rescale-failed" JobStatusUnknown JobStatus = "unknown" )
JobStatuses
type OnlineAction ¶
type OnlineAction string
OnlineAction defines the actions on the core business logic
const ( OnlineActionWrapJupyter OnlineAction = "wrap-jupyternotebook" OnlineActionRunJupyter OnlineAction = "run-jupyternotebook" OnlineActionSelectData OnlineAction = "select-data" OnlineActionDeleteImages OnlineAction = "delete-images" OnlineActionUpdateStatus OnlineAction = "update-dbstatus" OnlineActionConvertToSig OnlineAction = "convert-singularity" )
OnlineAction
type PlatformType ¶
type PlatformType int
PlatformType defines in where the job will be run
const ( PlatformKubernetes PlatformType = iota PlatformRescale )
PlatformTypes
func (PlatformType) String ¶
func (p PlatformType) String() string