Help us shape the future of Go! Take the 2026 Go Developer Survey

recruitment

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugRecruitStep

func DebugRecruitStep(
	ctx context.Context,
	db *sql.DB,
	qm *QuotaManager,
	creator WorkerCreator,
	stepID int32,
) error

func RecruiterCycle

func RecruiterCycle(
	ctx context.Context,
	db *sql.DB,
	qm *QuotaManager,
	creator WorkerCreator,
	recruiterTimers map[RecruiterKey]RecruiterState,
	workflowCounterMemory map[int32]WorkflowCounter,
	now time.Time,
) error

func StartRecruiterLoop

func StartRecruiterLoop(
	ctx context.Context,
	db *sql.DB,
	qm *QuotaManager,
	creator WorkerCreator,
	recruiterInterval int,
)

StartRecruitmentLoop runs the recruitment loop every interval duration

Types

type FlavorDetail

type FlavorDetail struct {
	FlavorID int32
	RegionID int32
	Cpu      int32
	Memory   float64
	Disk     float64
}

type QuotaManager

type QuotaManager struct {
	Quotas map[string]RegionalQuota // keyed by region/provider
	Usage  sync.Map                 // key = region/provider string, value = RegionalUsage
}

func NewQuotaManager

func NewQuotaManager(cfg *config.Config) *QuotaManager

NewQuotaManager builds a QuotaManager from the loaded configuration.

func (*QuotaManager) CanLaunch

func (qm *QuotaManager) CanLaunch(region, provider string, cpu int32, memGB float64) bool

func (*QuotaManager) RegisterDelete

func (qm *QuotaManager) RegisterDelete(region, provider string, cpu int32, memGB float32)

func (*QuotaManager) RegisterInstanceLimit added in v0.7.2

func (qm *QuotaManager) RegisterInstanceLimit(region, provider string)

RegisterInstanceLimit is called when a deployment fails with an instance-count error (e.g. PublicIPCountLimitReached). It learns the limit from the current usage so future deploys are blocked before hitting the Azure API.

func (*QuotaManager) RegisterLaunch

func (qm *QuotaManager) RegisterLaunch(region, provider string, cpu int32, memGB float32)

type Recruiter

type Recruiter struct {
	StepID                int32
	Rank                  int
	TimeoutSeconds        int
	Protofilter           string
	WorkerConcurrency     *int
	WorkerPrefetch        *int
	CpuPerTask            *int
	MemoryPerTask         *float32
	DiskPerTask           *float32
	ConcurrencyMax        *int
	ConcurrencyMin        *int
	PrefetchPercent       *int
	MaximumWorkers        *int
	CurrentWorkers        int
	Rounds                int
	PendingTasks          int
	ActiveTaskrate        int
	TargetTaskrate        int
	PotentialTaskrate     int
	WorkflowID            int32
	TimeoutPassed         bool // <- new field
	LastTrigger           time.Time
	RemainingUntilTimeout time.Duration
}

type RecruiterKey

type RecruiterKey struct {
	StepID int32
	Rank   int
}

type RecruiterState

type RecruiterState struct {
	LastTrigger time.Time
}

type RecyclableWorker

type RecyclableWorker struct {
	WorkerID    int32
	FlavorID    int32
	RegionID    int32
	StepID      *int32
	Concurrency int
	Scope       string
	WorkflowID  *int32
	Cpu         *int32
	Memory      *float64
	Disk        *float64
	Occupation  float64
}

type RegionInfo

type RegionInfo struct {
	Name       string
	Provider   string
	ProviderID int32
}

type RegionalQuota

type RegionalQuota struct {
	Region       string
	Provider     string
	MaxCPU       int32
	MaxMemGB     float32
	MaxInstances int32 // 0 = unlimited (learned from failures)
}

type RegionalUsage

type RegionalUsage struct {
	Region    string
	Provider  string
	UsedCPU   int32
	UsedMemGB float32
	Instances int32
}

type WorkerCreator

type WorkerCreator interface {
	CreateWorker(ctx context.Context, req *pb.WorkerRequest) (*pb.WorkerIds, error)
}

type WorkflowCounter

type WorkflowCounter struct {
	Counter int
	Maximum *int
}

Jump to

Keyboard shortcuts

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