sql_job_dispatcher

package
v0.0.0-...-c93f736 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	job_dispatcher.Job
	DeletedAt         gorm.DeletedAt `json:"deletedAt"`
	ParametersJSON    datatypes.JSON `json:"-" gorm:"type:jsonb;"` // json
	TasksJSON         datatypes.JSON `json:"-" gorm:"type:jsonb;"` // json
	CurrentStatusJSON datatypes.JSON `json:"-" gorm:"type:jsonb;"` // json
}

Job extends the model so that it works with sql

func (*Job) AfterFind

func (wj *Job) AfterFind(*gorm.DB) (err error)

func (*Job) BeforeSave

func (wj *Job) BeforeSave(*gorm.DB) (err error)

type SqlService

type SqlService struct{}

func (*SqlService) BulkNew

func (m *SqlService) BulkNew(newJobs []*job_dispatcher.Job) (err error)

BulkNew creates multiple new jobs

func (*SqlService) Clean

func (m *SqlService) Clean() (err error)

Clean cleans all stalled jobs

func (*SqlService) Complete

func (m *SqlService) Complete(job *job_dispatcher.Job) (err error)

Complete marks the job as completed

func (*SqlService) GetCurrentJobOfWorker

func (m *SqlService) GetCurrentJobOfWorker(
	workerInstances []string,
	currentWorkerUID uuid.UUID,
) (job *job_dispatcher.Job, found bool, err error)

GetCurrentJobOfWorker retrieves the job of the worker if one exists in the database

func (*SqlService) GetJobByUUID

func (m *SqlService) GetJobByUUID(uid uuid.UUID) (job *job_dispatcher.Job, err error)

GetJobByUUID returns a job by its unique identifier

func (*SqlService) GetLatestJob

func (m *SqlService) GetLatestJob(workerInstances []string,
	currentWorkerUID uuid.UUID) (job *job_dispatcher.Job, err error)

GetLatestJob returns the latest job

func (*SqlService) GetStats

func (m *SqlService) GetStats() (results []job_dispatcher.Stats, err error)

GetStats returns the statistics of each job instance

func (*SqlService) HeartBeat

func (m *SqlService) HeartBeat(job *job_dispatcher.Job, status map[string]interface{}) (err error)

HeartBeat marks a job as alive

func (*SqlService) New

func (m *SqlService) New(job *job_dispatcher.Job) (err error)

func (*SqlService) Release

func (m *SqlService) Release(job *job_dispatcher.Job) (err error)

Release releases the job

func (*SqlService) Start

func (m *SqlService) Start(job *job_dispatcher.Job) (err error)

Start marks a job as started

Jump to

Keyboard shortcuts

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