diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt index 48fdbe3dc80d1ae3da7cd590a8d9d2d437082ff8..da59a7e95e5ddd7cef37da3f251f597b43df29e6 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt @@ -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 diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index dea845ec4c9209c603641a57112acf52815430a7..f5a9222546cd63415a8c447a82054eaee1266849 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -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, diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt index 6be20df081753902ee5620baecd1c242b1a7f22d..47a27501f89621d8168ad381c71cbcb504511cdd 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt @@ -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, diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt index 93d1d729fee86ab8a9e1fd94a7d260c3a657ab9d..d30ae868732cf026ff2704ebe8362055fe5823a9 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -25,7 +25,7 @@ abstract class BenchmarkExecutor( val executionDuration: Duration, configurationOverrides: List<ConfigurationOverride?>, val slo: BenchmarkExecution.Slo, - val prefix: Int + val executionId: Int ) { /** diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index 3c68d9a65784d0bf5496d95c74e7387750c01139..0a1e37128720247c10e6f99965310b1634186ee9 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -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 diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index cfbd5d176e68a6a62a85fa487931d9b51f9237f2..ebddce03768cf8532bc719436344ef9e8f82e2b3 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -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)) } } }