metadata

package
v0.0.0-...-b44688a Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeEmpty    = ""
	TypeFlags    = "flags"
	TypeEnviron  = "environ"
	TypePlatform = "platform"
)

Predefined types of metadata. This selector allows to group metadata by their common characteristics. For instancje metadataKindFlags can be added to parameters passed to swan, metadataKindEnviron for environment variable and metadataKindPlatform for recorded platform characteristics like number of CPUs and so on. Note that metadataKind is just a string and each experiment can define it own personalized types of metadata.

View Source
const (
	// CPUModelNameKey defines a key in the platform metrics map
	CPUModelNameKey = "cpu_model"
	// KernelVersionKey defines a key in the platform metrics map
	KernelVersionKey = "kernel_version"
	// CentOSVersionKey defines a key in the platform metrics map
	CentOSVersionKey = "centos_version"
	// CPUTopologyKey defines a key in the platform metrics map
	CPUTopologyKey = "cpu_topology"
	// DockerVersionKey defines a key in the platform metrics map
	DockerVersionKey = "docker_version"
	// SnapteldVersionKey defines a key in the platform metrics map
	SnapteldVersionKey = "snapteld_version"
	// PowerGovernorKey defines a key in the platform metrics map
	PowerGovernorKey = "power_governor"
	// IRQAffinityKey defines a key in the platform metrics map
	IRQAffinityKey = "irq_affinity"
	// EtcdVersionKey defines a key in the platform metrics map
	EtcdVersionKey = "etcd_version"
)

Variables

This section is empty.

Functions

func CPUModelName

func CPUModelName() (string, error)

CPUModelName reads /proc/cpuinfo and returns line 'model name' line. Note that it returns only first occurrence of the model since mixed cpu models in > 2 CPUs are not supported In case of an error empty string is returned.

func CPUTopology

func CPUTopology() (string, error)

CPUTopology returns CPU topology returned by 'lscpu -e' command. The whole output of the command is returned. In case of an error empty string is returned

func CentOSVersion

func CentOSVersion() (string, error)

CentOSVersion returns OS version as stated in /etc/redhat-release In case of an error empty string is returned

func DockerVersion

func DockerVersion() (string, error)

DockerVersion returns docker version as returned by 'docker version' command. In case of an error empty string is returned

func EtcdVersion

func EtcdVersion() (string, error)

EtcdVersion returns etcd version as returned by 'etcd --version'. In case of an error empty string is returned

func GetPlatformMetrics

func GetPlatformMetrics() (platformMetrics map[string]string)

GetPlatformMetrics returns map of strings with platform metrics. If metric could not be retrieved value for the key is empty string.

func IRQAffinity

func IRQAffinity() (string, error)

IRQAffinity returns semicolon (;) separated list of pairs iface {comma separated list of pairs queue:affinity} Example:

enp0s31f6 {134:6};enp3s0 {129:5,130:4,131:3,132:2,133:2}

In case of an error empty string is returned

func KernelVersion

func KernelVersion() (string, error)

KernelVersion return kernel version as stated in /proc/version In case of an error empty string is returned

func PowerGovernor

func PowerGovernor() (string, error)

PowerGovernor returns a comma separated list of CPU:power_policy. Example (snippet):

"performance,1:performance,10:performance,11:performance"

In case of an error empty string is returned

func RecordRuntimeEnv

func RecordRuntimeEnv(metadata Metadata, experimentStart time.Time) error

RecordRuntimeEnv store experiment environment information in Cassandra.

func SnapteldVersion

func SnapteldVersion() (string, error)

SnapteldVersion returns snapteld version as returned by 'snapteld -v' command. In case of an error empty string is returned

Types

type Cassandra

type Cassandra struct {
	// contains filtered or unexported fields
}

Cassandra is a helper struct which keeps the Cassandra session alive, holds the active configuration and the experiment id to tag the metadata with.

func (*Cassandra) Clear

func (m *Cassandra) Clear() error

Clear deletes all metadata entries associated with the current experiment id.

func (*Cassandra) GetByKind

func (m *Cassandra) GetByKind(kind string) (map[string]string, error)

GetByKind retrive signle kind from the database. Returns error if no kind or too many groups found.

func (*Cassandra) Record

func (m *Cassandra) Record(key, value, kind string) error

Record stores a key and value and associates with the experiment id.

func (*Cassandra) RecordMap

func (m *Cassandra) RecordMap(metadata map[string]string, kind string) error

RecordMap stores a key and value map and associates with the experiment id.

type CassandraConfig

type CassandraConfig struct {
	Address           string
	ConnectionTimeout time.Duration
	CreateKeyspace    bool
	IgnorePeerAddr    bool
	InitialHostLookup bool
	KeyspaceName      string
	Password          string
	Port              int
	SslCAPath         string
	SslCertPath       string
	SslEnabled        bool
	SslHostValidation bool
	SslKeyPath        string
	Timeout           time.Duration
	Username          string
}

CassandraConfig encodes the settings for connecting to the database.

func DefaultCassandraConfig

func DefaultCassandraConfig() CassandraConfig

DefaultCassandraConfig applies the Cassandra settings from the command line flags and environment variables.

type InfluxDB

type InfluxDB struct {
	// contains filtered or unexported fields
}

InfluxDB is a helper struct which keeps the InfluxDB session alive, holds the active configuration and the experiment id to tag the metadata with.

func (*InfluxDB) Clear

func (m *InfluxDB) Clear() error

Clear deletes all metadata entries associated with the current experiment id.

func (*InfluxDB) GetByKind

func (m *InfluxDB) GetByKind(kind string) (map[string]string, error)

GetByKind retrive single kind from the database. If duplicates are found then the last one is returned. Returns error if no kind or too many groups found.

func (*InfluxDB) Record

func (m *InfluxDB) Record(key, value, kind string) error

Record stores a key and value and associates with the experiment id.

func (*InfluxDB) RecordMap

func (m *InfluxDB) RecordMap(metadata map[string]string, kind string) error

RecordMap stores a key and value map and associates with the experiment id.

type InfluxDBConfig

type InfluxDBConfig struct {
	// contains filtered or unexported fields
}

InfluxDBConfig holds configuration for InfluxDB

func DefaultInfluxDBConfig

func DefaultInfluxDBConfig() InfluxDBConfig

DefaultInfluxDBConfig applies the InfluxDB settings from the command line flags and environment variables.

type Metadata

type Metadata interface {
	// Record stores a key and value and associates with the experiment id.
	Record(key string, value string, kind string) error
	// RecordMap stores a key and value map and associates with the experiment id.
	RecordMap(metadata map[string]string, kind string) error
	// GetByKind retrives single metadata type from the database.
	// Returns error if no kind or too many groups found.
	GetByKind(kind string) (map[string]string, error)
	// Clear deletes all metadata entries associated with the current experiment id.
	Clear() error
}

Metadata interface defines methods which must be supported by DB backend

func NewCassandra

func NewCassandra(experimentID string, config CassandraConfig) (Metadata, error)

NewCassandra returns the Metadata helper from an experiment id and configuration.

func NewDefault

func NewDefault(experimentID string) (Metadata, error)

NewDefault initialize metadata object which is configured via env. variable.

func NewInfluxDB

func NewInfluxDB(experimentID string, config InfluxDBConfig) (Metadata, error)

NewInfluxDB returns the Metadata helper from an experiment id and configuration.

Jump to

Keyboard shortcuts

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