
Add a new API operation to get the overall farm status. This is based on the jobs and workers, and their status. The statuses are: - `active`: Actively working on jobs. - `idle`: Farm could be active, but has no work to do. - `waiting`: Work has been queued, but all workers are asleep. - `asleep`: Farm is idle, and all workers are asleep. - `inoperative`: Cannot work: no workers, or all are offline/error. - `starting`: Farm is starting up. - `unknown`: Unexpected configuration of worker and job statuses.
18 lines
614 B
Go
18 lines
614 B
Go
package farmstatus
|
|
|
|
import (
|
|
"context"
|
|
|
|
"projects.blender.org/studio/flamenco/internal/manager/persistence"
|
|
)
|
|
|
|
// Generate mock implementations of these interfaces.
|
|
//go:generate go run github.com/golang/mock/mockgen -destination mocks/interfaces_mock.gen.go -package mocks projects.blender.org/studio/flamenco/internal/manager/farmstatus PersistenceService
|
|
|
|
type PersistenceService interface {
|
|
SummarizeJobStatuses(ctx context.Context) (persistence.JobStatusCount, error)
|
|
SummarizeWorkerStatuses(ctx context.Context) (persistence.WorkerStatusCount, error)
|
|
}
|
|
|
|
var _ PersistenceService = (*persistence.DB)(nil)
|