db

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package db creates DB tables, call resource manager interfaces and populates the DB with compute units

Index

Constants

This section is empty.

Variables

View Source
var (

	// For estimating average values, we do weighted average method using following
	// values as weight for each DB column
	// For CPU and GPU, we use CPU time and GPU time as weights
	// For memory usage, we use Walltime * Mem for CPU as weight and just walltime
	// for GPU.
	Weights = map[string]string{
		"avg_cpu_usage":     "alloc_cputime",
		"avg_gpu_usage":     "alloc_gputime",
		"avg_cpu_mem_usage": "alloc_cpumemtime",
		"avg_gpu_mem_usage": "alloc_gpumemtime",
	}

	// Admin users sources.
	AdminUsersSources = []string{"ceems", "grafana"}
)
View Source
var MigrationsFS embed.FS
View Source
var StatementsFS embed.FS

Functions

func New added in v0.2.0

func New(c *Config) (*stats, error)

New returns a new instance of stats struct.

Types

type AdminConfig

type AdminConfig struct {
	Users   []string                `yaml:"users"`
	Grafana common.GrafanaWebConfig `yaml:"grafana"`
}

AdminConfig is the container for the admin users related config.

type Config

type Config struct {
	Logger          log.Logger
	Data            DataConfig
	Admin           AdminConfig
	ResourceManager func(log.Logger) (*resource.Manager, error)
	Updater         func(log.Logger) (*updater.UnitUpdater, error)
}

Config makes a DB config from config file.

type DataConfig

type DataConfig struct {
	Path               string         `yaml:"path"`
	BackupPath         string         `yaml:"backup_path"`
	RetentionPeriod    model.Duration `yaml:"retention_period"`
	UpdateInterval     model.Duration `yaml:"update_interval"`
	BackupInterval     model.Duration `yaml:"backup_interval"`
	LastUpdateTime     time.Time      `yaml:"update_from"`
	SkipDeleteOldUnits bool
}

DataConfig is the container for the data related config.

Directories

Path Synopsis
Package migrator implements database migrations
Package migrator implements database migrations

Jump to

Keyboard shortcuts

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