resource

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package resource defines the interface that each resource manager needs to implement to get compute units

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterManager

func RegisterManager(
	manager string,
	factory func(cluster models.Cluster, logger log.Logger) (Fetcher, error),
)

RegisterManager registers the resource manager into factory

Types

type Config

type Config[T any] struct {
	Clusters []T `yaml:"clusters"`
}

Config contains the configuration of resource manager cluster(s)

type Fetcher

type Fetcher interface {
	// FetchUnits fetches compute units between start and end times
	FetchUnits(start time.Time, end time.Time) ([]models.ClusterUnits, error)
	// FetchUsersProjects fetches latest projects, users and their associations
	FetchUsersProjects(currentTime time.Time) ([]models.ClusterUsers, []models.ClusterProjects, error)
}

Fetcher is the interface resource manager has to implement.

func NewDefaultResourceManager

func NewDefaultResourceManager(cluster models.Cluster, logger log.Logger) (Fetcher, error)

NewDefaultResourceManager returns a new defaultResourceManager that returns empty compute units

type Manager

type Manager struct {
	Fetchers []Fetcher
	Logger   log.Logger
}

Manager implements the interface to fetch compute units from different resource managers.

func NewManager

func NewManager(logger log.Logger) (*Manager, error)

NewManager creates a new Manager struct instance

func (Manager) FetchUnits

func (b Manager) FetchUnits(start time.Time, end time.Time) ([]models.ClusterUnits, error)

FetchUnits implements collection jobs between start and end times

func (Manager) FetchUsersProjects

func (b Manager) FetchUsersProjects(currentTime time.Time) ([]models.ClusterUsers, []models.ClusterProjects, error)

FetchUsersProjects fetches latest projects and users for each cluster

Directories

Path Synopsis
Package slurm implements the fetcher interface to fetch compute units from SLURM resource manager
Package slurm implements the fetcher interface to fetch compute units from SLURM resource manager

Jump to

Keyboard shortcuts

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