Documentation ¶
Index ¶
- Variables
- type BatchJob
- type BatchJobQueuedAction
- type BatchJobState
- type Job
- type JobState
- type Notebook
- type NotebookQueuedAction
- type NotebookState
- type S
- func (s *S) AutoMigrate() error
- func (s *S) CreateBatchJob(job *BatchJob) error
- func (s *S) CreateJob(job *Job) error
- func (s *S) CreateNotebook(nb *Notebook) error
- func (s *S) GetActiveNotebookByNameAndProjectID(name, projectID string) (*Notebook, error)
- func (s *S) GetBatchJobByIDAndProjectID(id, projectID string) (*BatchJob, error)
- func (s *S) GetJobByJobID(jobID string) (*Job, error)
- func (s *S) GetJobByJobIDAndProjectID(jobID, projectID string) (*Job, error)
- func (s *S) GetNotebookByID(id string) (*Notebook, error)
- func (s *S) GetNotebookByIDAndProjectID(id, projectID string) (*Notebook, error)
- func (s *S) ListActiveNotebooksByProjectIDWithPagination(projectID string, afterID uint, limit int) ([]*Notebook, bool, error)
- func (s *S) ListBatchJobsByProjectIDWithPagination(projectID string, afterID uint, limit int) ([]BatchJob, bool, error)
- func (s *S) ListJobsByProjectIDWithPagination(projectID string, afterID uint, limit int) ([]*Job, bool, error)
- func (s *S) ListJobsByTenantID(tenantID string) ([]*Job, error)
- func (s *S) ListQueuedJobs() ([]*Job, error)
- func (s *S) ListQueuedJobsByTenantID(tenantID string) ([]*Job, error)
- func (s *S) ListQueuedNotebooksByTenantID(tenantID string) ([]*Notebook, error)
- func (s *S) SetBatchJobQueuedAction(id string, currentVersion int, newActionn BatchJobQueuedAction) (*BatchJob, error)
- func (s *S) SetNonQueuedStateAndMessage(id string, currentVersion int, newState NotebookState, message []byte) error
- func (s *S) SetNotebookQueuedAction(id string, currentVersion int, newAction NotebookQueuedAction) (*Notebook, error)
- func (s *S) SetState(id string, currentVersion int, newState NotebookState) error
- func (s *S) UpdateJobState(jobID string, currentVersion int, newState JobState) error
- func (s *S) UpdateJobStateAndMessage(jobID string, currentVersion int, newState JobState, message []byte) error
- func (s *S) UpdateOutputModelID(jobID string, currentVersion int, outputModelID string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConcurrentUpdate is returned when there is a concurrent update. ErrConcurrentUpdate = fmt.Errorf("store: concurrent update") )
Functions ¶
This section is empty.
Types ¶
type BatchJob ¶ added in v0.175.0
type BatchJob struct { gorm.Model JobID string `gorm:"uniqueIndex"` Image string // Message is the marshaled message of the v1.BatchJob. Message []byte State BatchJobState // QueuedAction is the action of the batch job. This field is only used when // the state is BatchJobStateQueued, and processed by the dispatcher. QueuedAction BatchJobQueuedAction TenantID string OrganizationID string ProjectID string KubernetesNamespace string Version int }
BatchJob is a model of a batch job.
func (*BatchJob) MutateMessage ¶ added in v0.175.0
MutateMessage mutates the message of the batch job.
type BatchJobQueuedAction ¶ added in v0.175.0
type BatchJobQueuedAction string
BatchJobQueuedAction is the action of a queue batch job.
const ( // BatchJobQueuedActionCreate is the action to create a batch job. BatchJobQueuedActionCreate BatchJobQueuedAction = "creating" // BatchJobQueuedActionCancel is the action to cancel a batch job. BatchJobQueuedActionCancel BatchJobQueuedAction = "canceling" )
type BatchJobState ¶ added in v0.175.0
type BatchJobState string
BatchJobState is the state of a batch job.
const ( // BatchJobStateQueued is the state of a notebook that is waiting to be processed. BatchJobStateQueued BatchJobState = "queued" // BatchJobStateRunning is the state of a batch job that is currently running. BatchJobStateRunning BatchJobState = "running" // BatchJobStateSucceeded is the state of a batch job that has completed successfully. BatchJobStateSucceeded BatchJobState = "succeeded" // BatchJobStateFailed is the state of a batch job that has completed with an error. BatchJobStateFailed BatchJobState = "failed" // BatchJobStateCanceled is the state of a batch job that has been canceled. BatchJobStateCanceled BatchJobState = "canceled" )
type Job ¶
type Job struct { gorm.Model JobID string `gorm:"uniqueIndex:idx_job_job_id"` // Message is the marshaled proto message of v1.Job. Message []byte // Suffix is a string that will be added to a fine-tuned model name. Suffix string State JobState `gorm:"index:idx_job_state_tenant_id"` TenantID string `gorm:"index:idx_job_state_tenant_id"` OrganizationID string ProjectID string `gorm:"index"` KubernetesNamespace string // OutputModelID is the ID of a generated model. OutputModelID string Version int }
Job represents a job.
func (*Job) MutateMessage ¶
MutateMessage mutates the message field of a job.
func (*Job) V1InternalJob ¶
func (j *Job) V1InternalJob() (*v1.InternalJob, error)
V1InternalJob converts a job to v1.InternalJob.
type JobState ¶
type JobState string
JobState represents the state of a job.
const ( // JobStateQueued represents the pending state. JobStateQueued JobState = "queued" // JobStateRunning represents the running state. JobStateRunning JobState = "running" // JobStateFailed represents the failed state. JobStateFailed JobState = "failed" // JobStateSucceeded represents the succeeded state. JobStateSucceeded JobState = "succeeded" // JobStateCancelled represents the cancelled state. JobStateCancelled JobState = "cancelled" )
type Notebook ¶
type Notebook struct { gorm.Model NotebookID string `gorm:"uniqueIndex"` Image string // Message is the marshalled JSON of the v1.Notebook. Message []byte State NotebookState // QueuedAction is the action of the queued notebook. This field is only used when // the state is NotebookStateQueued, and processed by the dispatcher. QueuedAction NotebookQueuedAction TenantID string OrganizationID string ProjectID string `gorm:"index:idx_notebook_project_id_name"` KubernetesNamespace string // ClusterID is the ID of the cluster where the job runs. ClusterID string // We do not use a unique index here since the same notebook name can be used if there is only one active noteobook. Name string `gorm:"index:idx_notebook_project_id_name"` Version int }
Notebook is a model of notebook.
func (*Notebook) MutateMessage ¶
MutateMessage mutates the message field of a notebook.
func (*Notebook) V1InternalNotebook ¶
func (n *Notebook) V1InternalNotebook() (*v1.InternalNotebook, error)
V1InternalNotebook converts a notebook to a v1.InternalNotebook.
type NotebookQueuedAction ¶
type NotebookQueuedAction string
NotebookQueuedAction is the action of a queued notebook.
const ( // NotebookQueuedActionStart is the action to start a notebook. NotebookQueuedActionStart NotebookQueuedAction = "starting" // NotebookQueuedActionStop is the action to stop a notebook. NotebookQueuedActionStop NotebookQueuedAction = "stopping" // NotebookQueuedActionDelete is the action to delete a notebook. NotebookQueuedActionDelete NotebookQueuedAction = "deleting" )
type NotebookState ¶
type NotebookState string
NotebookState is the state of a notebook.
const ( // NotebookStateQueued is the state of a notebook that is waiting to be scheduled. NotebookStateQueued NotebookState = "queued" // NotebookStateInitializing is the state of a notebook that is initializing. NotebookStateInitializing NotebookState = "initializing" // NotebookStateRunning is the state of a notebook that is currently running. NotebookStateRunning NotebookState = "running" // NotebookStateStopped is the state of a notebook that has been stopped. NotebookStateStopped NotebookState = "stopped" // NotebookStateFailed is the state of a notebook that has failed. NotebookStateFailed NotebookState = "failed" // NotebookStateDeleted is the state of a notebook that has been deleted. NotebookStateDeleted NotebookState = "deleted" )
type S ¶
type S struct {
// contains filtered or unexported fields
}
S represents the data store.
func (*S) AutoMigrate ¶
AutoMigrate sets up the auto-migration task of the database.
func (*S) CreateBatchJob ¶ added in v0.175.0
CreateBatchJob creates a batch job.
func (*S) CreateNotebook ¶
CreateNotebook creates a new notebook.
func (*S) GetActiveNotebookByNameAndProjectID ¶ added in v0.159.0
GetActiveNotebookByNameAndProjectID gets an active notebook by its name and project ID.
func (*S) GetBatchJobByIDAndProjectID ¶ added in v0.175.0
GetBatchJobByIDAndProjectID gets a batch job by its job ID and project ID.
func (*S) GetJobByJobID ¶
GetJobByJobID gets a job.
func (*S) GetJobByJobIDAndProjectID ¶
GetJobByJobIDAndProjectID gets a job by its job ID and project ID.
func (*S) GetNotebookByID ¶
GetNotebookByID gets a notebook by its notebook ID.
func (*S) GetNotebookByIDAndProjectID ¶
GetNotebookByIDAndProjectID gets a notebook by its notebook ID and project ID.
func (*S) ListActiveNotebooksByProjectIDWithPagination ¶
func (s *S) ListActiveNotebooksByProjectIDWithPagination(projectID string, afterID uint, limit int) ([]*Notebook, bool, error)
ListActiveNotebooksByProjectIDWithPagination finds active notebooks with pagination. Notebooks are returned with a descending order of ID.
func (*S) ListBatchJobsByProjectIDWithPagination ¶ added in v0.175.0
func (s *S) ListBatchJobsByProjectIDWithPagination(projectID string, afterID uint, limit int) ([]BatchJob, bool, error)
ListBatchJobsByProjectIDWithPagination lists batch jobs by project ID with pagination.
func (*S) ListJobsByProjectIDWithPagination ¶
func (s *S) ListJobsByProjectIDWithPagination(projectID string, afterID uint, limit int) ([]*Job, bool, error)
ListJobsByProjectIDWithPagination finds jobs with pagination. Jobs are returned with a descending order of ID.
func (*S) ListJobsByTenantID ¶
ListJobsByTenantID finds jobs.
func (*S) ListQueuedJobs ¶
ListQueuedJobs finds queued jobs.
func (*S) ListQueuedJobsByTenantID ¶
ListQueuedJobsByTenantID finds queued jobs.
func (*S) ListQueuedNotebooksByTenantID ¶
ListQueuedNotebooksByTenantID finds queued notebooks by tenant ID.
func (*S) SetBatchJobQueuedAction ¶ added in v0.175.0
func (s *S) SetBatchJobQueuedAction(id string, currentVersion int, newActionn BatchJobQueuedAction) (*BatchJob, error)
SetBatchJobQueuedAction sets the queued action of a batch job.
func (*S) SetNonQueuedStateAndMessage ¶
func (s *S) SetNonQueuedStateAndMessage(id string, currentVersion int, newState NotebookState, message []byte) error
SetNonQueuedStateAndMessage sets a non-queued state and message.
func (*S) SetNotebookQueuedAction ¶
func (s *S) SetNotebookQueuedAction(id string, currentVersion int, newAction NotebookQueuedAction) (*Notebook, error)
SetNotebookQueuedAction sets a notebook queued action.
func (*S) SetState ¶ added in v0.170.0
func (s *S) SetState(id string, currentVersion int, newState NotebookState) error
SetState sets a state.
func (*S) UpdateJobState ¶
UpdateJobState updates a job.