worker

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 15 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoWorker = fmt.Errorf("cds: no worker found")

ErrNoWorker means the given worker ID is not found

Functions

func Delete

func Delete(db gorp.SqlExecutor, id string) error

Delete remove worker from database, it also removes the associated consumer.

func DeleteDeadWorkers

func DeleteDeadWorkers(ctx context.Context, db *gorp.DbMap) error

DeleteDeadWorkers delete all workers which is disabled

func DisableDeadWorkers

func DisableDeadWorkers(ctx context.Context, db *gorp.DbMap) error

DisableDeadWorkers put status disabled to all dead workers with status Registering, Waiting or Building

func Initialize

func Initialize(c context.Context, DBFunc func() *gorp.DbMap, store cache.Store) error

Initialize init the package

func LoadAll

func LoadAll(ctx context.Context, db gorp.SqlExecutor) ([]sdk.Worker, error)

func LoadAllByHatcheryID

func LoadAllByHatcheryID(ctx context.Context, db gorp.SqlExecutor, hatcheryID int64) ([]sdk.Worker, error)

func LoadByConsumerID

func LoadByConsumerID(ctx context.Context, db gorp.SqlExecutor, id string) (*sdk.Worker, error)

func LoadByID

func LoadByID(ctx context.Context, db gorp.SqlExecutor, id string, opts ...gorpmapping.GetOptionFunc) (*sdk.Worker, error)

func LoadDeadWorkers

func LoadDeadWorkers(ctx context.Context, db gorp.SqlExecutor, timeout float64, status []string) ([]sdk.Worker, error)

func LoadWorkerByName

func LoadWorkerByName(ctx context.Context, db gorp.SqlExecutor, workerName string) (*sdk.Worker, error)

LoadWorkerByIDWithDecryptKey load worker with decrypted private key

func LoadWorkerByNameWithDecryptKey

func LoadWorkerByNameWithDecryptKey(ctx context.Context, db gorp.SqlExecutor, workerName string) (*sdk.Worker, error)

LoadWorkerByIDWithDecryptKey load worker with decrypted private key

func ReAttachAllToHatchery

func ReAttachAllToHatchery(ctx context.Context, db gorpmapper.SqlExecutorWithTx, hatchery sdk.Service) error

ReAttachAllToHatchery search for workers without hatchery an re-attach workers if the hatchery consumer match worker consumer's parent.

func RefreshWorker

func RefreshWorker(db gorp.SqlExecutor, id string) error

RefreshWorker Update worker last_beat

func RegisterWorker

func RegisterWorker(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store cache.Store,
	spawnArgs hatchery.SpawnArgumentsJWT, hatcheryService sdk.Service, hatcheryConsumer *sdk.AuthUserConsumer, workerConsumer *sdk.AuthUserConsumer,
	registrationForm sdk.WorkerRegistrationForm, runNodeJob *sdk.WorkflowNodeJobRun) (*sdk.Worker, error)

RegisterWorker Register new worker

func ReleaseAllFromHatchery

func ReleaseAllFromHatchery(db gorp.SqlExecutor, hatcheryID int64) error

ReleaseAllFromHatchery remove dependency to given given hatchery for all workers linked to it.

func SetStatus

func SetStatus(ctx context.Context, db gorpmapper.SqlExecutorWithTx, workerID string, status string) error

SetStatus sets job_run_id and status to building on given worker

func SetToBuilding

func SetToBuilding(ctx context.Context, db gorpmapper.SqlExecutorWithTx, workerID string, jobRunID int64, key []byte) error

SetToBuilding sets job_run_id and status to building on given worker

Types

type RegistrationForm

type RegistrationForm struct {
	Name               string
	Token              string
	ModelID            int64
	Hatchery           int64
	HatcheryName       string
	BinaryCapabilities []string
	Version            string
	OS                 string
	Arch               string
}

RegistrationForm represents the arguments needed to register a worker

type TakeForm

type TakeForm struct {
	BookedJobID int64
	Time        time.Time
}

TakeForm contains booked JobID if exists

Jump to

Keyboard shortcuts

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