Documentation ¶
Index ¶
- Variables
- type Job
- type JobState
- type S
- func (s *S) AutoMigrate() error
- func (s *S) CreateJob(job *Job) error
- func (s *S) GetJobByJobID(jobID string) (*Job, error)
- func (s *S) ListJobsByTenantID(tenantID string) ([]*Job, error)
- func (s *S) ListPendingJobs() ([]*Job, error)
- func (s *S) ListPendingJobsByTenantID(tenantID string) ([]*Job, error)
- func (s *S) UpdateJobState(jobID string, currentVersion int, newState JobState) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrConcurrentUpdate is returned when there is a concurrent update. ErrConcurrentUpdate = fmt.Errorf("store: concurrent update") )
Functions ¶
This section is empty.
Types ¶
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"` Version int }
Job represents a job.
type JobState ¶
type JobState string
JobState represents the state of a job.
const ( // JobStatePending represents the pending state. // TODO(kenji): Consider renaming this to "queued" to be consistent with OpenAI API. JobStatePending JobState = "pending" // JobStateRunning represents the running state. JobStateRunning JobState = "running" // JobStateCompleted represents the completed state. // TODO(kenji): Consider renaming this to "succeeded" or "failed" to be consistent with OpenAI API. JobStateCompleted JobState = "completed" // JobStateCancelled represents the cancelled state. JobStateCancelled JobState = "cancelled" )
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) GetJobByJobID ¶
GetJobByJobID gets a job.
func (*S) ListJobsByTenantID ¶
ListJobsByTenantID finds jobs.
func (*S) ListPendingJobs ¶
ListPendingJobs finds pending jobs.
func (*S) ListPendingJobsByTenantID ¶
ListPendingJobsByTenantID finds pending jobs.
Click to show internal directories.
Click to hide internal directories.