experiment

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExperimentKey defines the key for Snap tag.
	ExperimentKey = "swan_experiment"
	// PhaseKey defines the key for Snap tag.
	PhaseKey = "swan_phase"
	// RepetitionKey defines the key for Snap tag.
	RepetitionKey = "swan_repetition"
	// LoadPointQPSKey defines the key for Snap tag.
	LoadPointQPSKey = "swan_loadpoint_qps"
	// AggressorNameKey defines the key for Snap tag.
	AggressorNameKey = "swan_aggressor_name"

	// ExUsage represents command line user error exit code
	ExUsage = 64
	// ExSoftware represents internal software error exit code
	ExSoftware = 70
	// ExIOErr represents input/output error exit code
	ExIOErr = 74
)
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

View Source
var (
	// RunOnKubernetesFlag indicates that experiment is to be run on K8s cluster.
	RunOnKubernetesFlag = conf.NewBoolFlag("kubernetes", "Launch Kubernetes cluster and run workloads on Kubernetes. This flag is required to use other kubernetes flags. (caveat: cluster won't be started if `-kubernetes_run_on_existing` flag is set).  ", false)
	// RunOnExistingKubernetesFlag indicates that experiment should not set up a Kubernetes cluster but use an existing one.
	RunOnExistingKubernetesFlag = conf.NewBoolFlag("kubernetes_run_on_existing", "Launch HP and BE tasks on existing Kubernetes cluster. (It has to be used with --kubernetes flag). User should provide 'kubernetes_kubeconfig' flag to kubeconfig to point proper API server.", false)
)

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 Configure

func Configure() bool

Configure handles configuration parsing, generation and restoration based on config-* flags. Note: exits if configuration generation was requested. This function must reside in experiment package because depends on metadata access. Returns information about current log level.

func CreateExperimentDir

func CreateExperimentDir(uuid, appName string) (experimentDirectory string, logFile *os.File, err error)

CreateExperimentDir creates directory structure for the experiment.

func CreateRepetitionDir

func CreateRepetitionDir(appName, uuid, phaseName string, repetition int) error

CreateRepetitionDir creates folders that store repetition logs inside experiment's directory.

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 GetPeakLoad

func GetPeakLoad(hpLauncher executor.Launcher, loadGenerator executor.LoadGenerator, slo int) (peakLoad int, err error)

GetPeakLoad runs tuning in order to determine the peak load.

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 LaunchKubernetesCluster

func LaunchKubernetesCluster() (clusterHandle executor.TaskHandle, err error)

LaunchKubernetesCluster starts new Kubernetes cluster using configuration provided with flags.

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 ShouldLaunchKubernetesCluster

func ShouldLaunchKubernetesCluster() bool

ShouldLaunchKubernetesCluster checks RunOnKubernetesFlag and RunOnExistingKubernetesFlag and returns information if Kubernetes cluster should be launched.

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 Metadata

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

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

func NewMetadata

func NewMetadata(experimentID string, config MetadataConfig) (*Metadata, error)

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

func (*Metadata) Clear

func (m *Metadata) Clear() error

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

func (*Metadata) Get

func (m *Metadata) Get() ([]MetadataMap, error)

Get retrieves all metadata maps from the database.

func (*Metadata) GetGroup

func (m *Metadata) GetGroup(kind string) (MetadataMap, error)

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

func (*Metadata) Record

func (m *Metadata) Record(key string, value string) error

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

func (*Metadata) RecordMap

func (m *Metadata) RecordMap(metadata MetadataMap) error

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

func (*Metadata) RecordRuntimeEnv

func (m *Metadata) RecordRuntimeEnv(experimentStart time.Time) error

RecordRuntimeEnv store experiment environment information in Cassandra.

type MetadataConfig

type MetadataConfig struct {
	CassandraAddress           string
	CassandraConnectionTimeout time.Duration
	CassandraCreateKeyspace    bool
	CassandraIgnorePeerAddr    bool
	CassandraInitialHostLookup bool
	CassandraKeyspaceName      string
	CassandraPassword          string
	CassandraPort              int
	CassandraSslCAPath         string
	CassandraSslCertPath       string
	CassandraSslEnabled        bool
	CassandraSslHostValidation bool
	CassandraSslKeyPath        string
	CassandraTimeout           time.Duration
	CassandraUsername          string
}

MetadataConfig encodes the settings for connecting to the database.

func DefaultMetadataConfig

func DefaultMetadataConfig() MetadataConfig

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

type MetadataMap

type MetadataMap map[string]string

MetadataMap encodes the key value pairs to be stored in Cassandra.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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