diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt index b905677103a65b579a0f3b4b0374ba182ff1ace5..751e2d322f628f9e1b5ff854f8f6445d20f25f13 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -1,11 +1,14 @@ package theodolite.execution +import mu.KotlinLogging import theodolite.util.Benchmark import theodolite.util.LoadDimension import theodolite.util.Resource import theodolite.util.Results import java.time.Duration +private val logger = KotlinLogging.logger {} + /** * The Benchmark Executor runs a single experiment. * @@ -23,4 +26,15 @@ abstract class BenchmarkExecutor(val benchmark: Benchmark, val results: Results, * @return True, if the number of resources are suitable for the given load, false otherwise. */ abstract fun runExperiment(load: LoadDimension, res: Resource): Boolean; + + /** + * Wait while the benchmark is running and log the number of minutes executed every 1 minute. + * + */ + fun waitAndLog() { + for (i in 1.rangeTo(executionDuration.toMinutes())) { + Thread.sleep(Duration.ofMinutes(1).toMillis()) + logger.info { "Executed: $i minutes" } + } + } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index 3ddd0758430a141657dfcdc6b28f140c4bd2c7c9..189b32043447aae73c2cc69c12fa52b87dcacc3b 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -7,8 +7,6 @@ import theodolite.util.Resource import theodolite.util.Results import java.time.Duration -private val logger = KotlinLogging.logger {} - class BenchmarkExecutorImpl(benchmark: Benchmark, results: Results, executionDuration: Duration) : BenchmarkExecutor(benchmark, results, executionDuration) { override fun runExperiment(load: LoadDimension, res: Resource): Boolean { benchmark.start(load, res) @@ -19,11 +17,4 @@ class BenchmarkExecutorImpl(benchmark: Benchmark, results: Results, executionDur this.results.setResult(Pair(load, res), result) return result; } - - private fun waitAndLog() { - for (i in 1.rangeTo(executionDuration.toMinutes())) { - Thread.sleep(Duration.ofMinutes(1).toMillis()) - logger.info { "Executed: $i minutes" } - } - } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/DeploymentManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/DeploymentManager.kt index 3731b98fa2dd1096d357de53ee0defcd8adf037f..af59c523633d448da96d533c819823b5be5215c7 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/DeploymentManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/DeploymentManager.kt @@ -34,7 +34,7 @@ class DeploymentManager(private val client: NamespacedKubernetesClient) { } /** - * Set the enviroment Variable for a container + * Set the environment Variable for a container */ fun setWorkloadEnv(workloadDeployment: Deployment, containerName: String, map: Map<String, String>) { workloadDeployment.spec.template.spec.containers.filter { it.name == containerName } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt index bf504c7cf1e3f6616ccf64d0ae1edc02d9fbc1dc..4f75298f37472b00d9c2576c6c249c179c04194d 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt @@ -8,8 +8,8 @@ import org.apache.kafka.clients.admin.NewTopic private val logger = KotlinLogging.logger {} -class TopicManager(boostrapIp: String) { - private val props = hashMapOf<String, Any>(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG to boostrapIp) +class TopicManager(bootstrapServers: String) { + private val props = hashMapOf<String, Any>(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG to bootstrapServers) lateinit var kafkaAdmin: AdminClient init { @@ -20,22 +20,22 @@ class TopicManager(boostrapIp: String) { } } - fun createTopics(topics: Map<String, Int>, replicationfactor: Short) { + fun createTopics(topics: Map<String, Int>, replicationFactor: Short) { val newTopics = mutableSetOf<NewTopic>() for (i in topics) { - val tops = NewTopic(i.key, i.value, replicationfactor) + val tops = NewTopic(i.key, i.value, replicationFactor) newTopics.add(tops) } kafkaAdmin.createTopics(newTopics) logger.info {"Topics created"} } - fun createTopics(topics: List<String>, numPartitions: Int, replicationfactor: Short) { + fun createTopics(topics: List<String>, numPartitions: Int, replicationFactor: Short) { val newTopics = mutableSetOf<NewTopic>() for (i in topics) { - val tops = NewTopic(i, numPartitions, replicationfactor) + val tops = NewTopic(i, numPartitions, replicationFactor) newTopics.add(tops) } kafkaAdmin.createTopics(newTopics) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt index 506014e0a6569c1f0ef2fe9c77387eb5fb300b40..7e1347973cb5663e39e13a68533b336dea03b825 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt @@ -51,10 +51,6 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { } override fun initializeClusterEnvironment() { - // this.workloadGeneratorStateCleaner.deleteAll() - // since the workloadGenerators are not started they cant be deleted - - this.topicManager.deleteTopics(this.config.kafkaTopics) this.topicManager.createTopics( this.config.kafkaTopics, this.config.kafkaPartition, diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt index ffdc3e6d55f55721229c902f8aaba36df625355f..5e37e97dfaefeb2761d13173efbfbd2b6adc41e7 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt @@ -63,7 +63,7 @@ class YamlLoader(private val client: NamespacedKubernetesClient) { } if (resource == null) { - throw NullPointerException("The Ressource at path: $path could not be loaded") + throw IllegalArgumentException("The Resource at path: $path could not be loaded") } return resource diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt index dfe05009d05b63120d212f6208b05e929bf47e4f..093ef3b100ae53babf0b873d6133a9571196bcdd 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt @@ -5,7 +5,8 @@ import theodolite.util.LoadDimension import theodolite.util.Resource /** - * The Lower Bound Restriction + * The Lower Bound Restriction sets the lower bound of the resources to be examined to the value + * needed to successfully execute the next smaller load. * * @param results Result object used as a basis to restrict the resources. */