MCPcopy Create free account
hub / github.com/cloudbase/garm / addRunnerToPool

Method addRunnerToPool

runner/pool/pool.go:1326–1344  ·  view source on GitHub ↗
(pool params.Pool, aditionalLabels []string)

Source from the content-addressed store, hash-verified

1324}
1325
1326func (r *basePoolManager) addRunnerToPool(pool params.Pool, aditionalLabels []string) error {
1327 if !pool.Enabled {
1328 return fmt.Errorf("pool %s is disabled", pool.ID)
1329 }
1330
1331 poolInstanceCount, err := r.store.PoolInstanceCount(r.ctx, pool.ID)
1332 if err != nil {
1333 return fmt.Errorf("failed to list pool instances: %w", err)
1334 }
1335
1336 if poolInstanceCount >= int64(pool.MaxRunners) {
1337 return fmt.Errorf("max workers (%d) reached for pool %s", pool.MaxRunners, pool.ID)
1338 }
1339
1340 if err := r.AddRunner(r.ctx, pool.ID, aditionalLabels); err != nil {
1341 return fmt.Errorf("failed to add new instance for pool %s: %w", pool.ID, err)
1342 }
1343 return nil
1344}
1345
1346func (r *basePoolManager) ensureIdleRunnersForOnePool(pool params.Pool) error {
1347 if !pool.Enabled || pool.MinIdleRunners == 0 {

Callers 1

consumeQueuedJobsMethod · 0.95

Calls 2

AddRunnerMethod · 0.95
PoolInstanceCountMethod · 0.65

Tested by

no test coverage detected