Skip to content
Snippets Groups Projects
Commit 1810eb2c authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

Add Saving of results + rename prefix

parent 4907a647
Branches
Tags
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!111Add prefix to output files to link results and experiment,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
......@@ -6,7 +6,7 @@ import kotlin.properties.Delegates
@RegisterForReflection
class BenchmarkExecution {
var prefix: Int = 0
var executionId: Int = 0
lateinit var name: String
lateinit var benchmark: String
lateinit var load: LoadDefinition
......
......@@ -49,12 +49,17 @@ class KubernetesBenchmark : Benchmark {
val patcherFactory = PatcherFactory()
// patch the load dimension the resources
load.getType().forEach { patcherDefinition -> patcherFactory.createPatcher(patcherDefinition, resources).patch(load.get().toString()) }
res.getType().forEach{ patcherDefinition -> patcherFactory.createPatcher(patcherDefinition, resources).patch(res.get().toString()) }
load.getType().forEach { patcherDefinition ->
patcherFactory.createPatcher(patcherDefinition, resources).patch(load.get().toString())
}
res.getType().forEach { patcherDefinition ->
patcherFactory.createPatcher(patcherDefinition, resources).patch(res.get().toString())
}
// Patch the given overrides
configurationOverrides.forEach { override -> override?.let { patcherFactory.createPatcher(it.patcher, resources).patch(override.value) } }
configurationOverrides.forEach { override ->
override?.let { patcherFactory.createPatcher(it.patcher, resources).patch(override.value) }
}
return KubernetesBenchmarkDeployment(
namespace = namespace,
......
......@@ -11,7 +11,7 @@ private val logger = KotlinLogging.logger {}
class AnalysisExecutor(
private val slo: BenchmarkExecution.Slo,
private val prefix: Int
private val executionId: Int
) {
private val fetcher = MetricFetcher(
......@@ -29,7 +29,7 @@ class AnalysisExecutor(
query = "sum by(group)(kafka_consumergroup_group_lag >= 0)"
)
CsvExporter().toCsv(name = "$prefix-${load.get()}-${res.get()}-${slo.sloType}", prom = prometheusData)
CsvExporter().toCsv(name = "$executionId-${load.get()}-${res.get()}-${slo.sloType}", prom = prometheusData)
val sloChecker = SloCheckerFactory().create(
slotype = slo.sloType,
externalSlopeURL = slo.externalSloUrl,
......
......@@ -25,7 +25,7 @@ abstract class BenchmarkExecutor(
val executionDuration: Duration,
configurationOverrides: List<ConfigurationOverride?>,
val slo: BenchmarkExecution.Slo,
val prefix: Int
val executionId: Int
) {
/**
......
......@@ -20,14 +20,14 @@ class BenchmarkExecutorImpl(
executionDuration: Duration,
private val configurationOverrides: List<ConfigurationOverride?>,
slo: BenchmarkExecution.Slo,
prefix: Int
) : BenchmarkExecutor(benchmark, results, executionDuration, configurationOverrides, slo, prefix) {
executionId: Int
) : BenchmarkExecutor(benchmark, results, executionDuration, configurationOverrides, slo, executionId) {
override fun runExperiment(load: LoadDimension, res: Resource): Boolean {
val benchmarkDeployment = benchmark.buildDeployment(load, res, this.configurationOverrides)
benchmarkDeployment.setup()
this.waitAndLog()
val result = AnalysisExecutor(slo = slo, prefix = prefix).analyse(
val result = AnalysisExecutor(slo = slo, executionId = executionId).analyse(
load = load,
res = res,
executionDuration = executionDuration
......
......@@ -33,12 +33,12 @@ class TheodoliteExecutor(
val executor =
BenchmarkExecutorImpl(
kubernetesBenchmark,
results,
executionDuration,
config.configOverrides,
config.slos[0],
prefix = config.prefix
benchmark = kubernetesBenchmark,
results = results,
executionDuration = executionDuration,
configurationOverrides = config.configOverrides,
slo = config.slos[0],
executionId = config.executionId
)
return Config(
......@@ -61,22 +61,22 @@ class TheodoliteExecutor(
}
fun run() {
saveConfiguration()
storeAsFile(this.config, "${this.config.executionId}-execution-configuration")
storeAsFile(kubernetesBenchmark, "${this.config.executionId}-benchmark-configuration")
val config = buildConfig()
// execute benchmarks for each load
for (load in config.loads) {
config.compositeStrategy.findSuitableResource(load, config.resources)
}
storeAsFile(config.compositeStrategy.benchmarkExecutor.results, "${this.config.executionId}-result")
}
fun saveConfiguration() {
val gson = GsonBuilder().setPrettyPrinting().create()
private fun <T> storeAsFile(saveObject: T, filename: String) {
val gson = GsonBuilder().enableComplexMapKeySerialization().setPrettyPrinting().create()
PrintWriter("${this.config.prefix}-execution-configuration").use { pw ->
pw.println(gson.toJson(this.config))
}
PrintWriter("${this.config.prefix}-benchmark-configuration").use { pw ->
pw.println(gson.toJson(kubernetesBenchmark))
PrintWriter(filename).use { pw ->
pw.println(gson.toJson(saveObject))
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment