local

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: 25 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HatcheryConfiguration

type HatcheryConfiguration struct {
	service.HatcheryCommonConfiguration `mapstructure:"commonConfiguration" toml:"commonConfiguration" json:"commonConfiguration"`
	Basedir                             string `mapstructure:"basedir" toml:"basedir" default:"/var/lib/cds-engine" comment:"BaseDir for worker workspace" json:"basedir"`
}

HatcheryConfiguration is the configuration for local hatchery

type HatcheryLocal

type HatcheryLocal struct {
	hatcheryCommon.Common
	Config HatcheryConfiguration
	sync.Mutex

	LocalWorkerRunner LocalWorkerRunner
	// BasedirDedicated = basedir + hatchery.name
	// this directory contains the worker donwloaded from api at startup
	BasedirDedicated string
	// contains filtered or unexported fields
}

HatcheryLocal implements HatcheryMode interface for local usage

func New

func New() *HatcheryLocal

New instanciates a new hatchery local

func (*HatcheryLocal) ApplyConfiguration

func (h *HatcheryLocal) ApplyConfiguration(cfg interface{}) error

ApplyConfiguration apply an object of type HatcheryConfiguration after checking it

func (*HatcheryLocal) CanSpawn

func (h *HatcheryLocal) CanSpawn(ctx context.Context, _ sdk.WorkerStarterWorkerModel, jobID string, requirements []sdk.Requirement) bool

CanSpawn return wether or not hatchery can spawn model. requirements are not supported

func (*HatcheryLocal) CheckConfiguration

func (h *HatcheryLocal) CheckConfiguration(cfg interface{}) error

CheckConfiguration checks the validity of the configuration object

func (*HatcheryLocal) Configuration

Configuration returns Hatchery CommonConfiguration

func (*HatcheryLocal) Init

func (h *HatcheryLocal) Init(config interface{}) (cdsclient.ServiceConfig, error)

func (*HatcheryLocal) InitHatchery

func (h *HatcheryLocal) InitHatchery(ctx context.Context) error

InitHatchery register local hatchery with its worker model

func (*HatcheryLocal) Serve

func (h *HatcheryLocal) Serve(ctx context.Context) error

Serve start the hatchery server

func (*HatcheryLocal) Signin added in v0.53.0

func (h *HatcheryLocal) Signin(ctx context.Context, clientConfig cdsclient.ServiceConfig, srvConfig interface{}) error

func (*HatcheryLocal) SpawnWorker

func (h *HatcheryLocal) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error

SpawnWorker starts a new worker process

func (*HatcheryLocal) Start

func (h *HatcheryLocal) Start(ctx context.Context) error

Start inits client and routines for hatchery

func (*HatcheryLocal) Status

Status returns sdk.MonitoringStatus, implements interface service.Service

func (*HatcheryLocal) WorkersStarted

func (h *HatcheryLocal) WorkersStarted(ctx context.Context) ([]string, error)

WorkersStarted returns the number of instances started but not necessarily register on CDS yet

type LocalWorkerRunner

type LocalWorkerRunner interface {
	NewCmd(ctx context.Context, command string, args ...string) *exec.Cmd
}

type Logger

type Logger interface {
	Logf(fmt string, values ...interface{})
	Errorf(fmt string, values ...interface{})
	Fatalf(fmt string, values ...interface{})
}

Jump to

Keyboard shortcuts

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