From 1f0e91c1b904e5ea3c6f992121334fa6a0389fe2 Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Thu, 22 Apr 2021 17:04:36 +0200 Subject: [PATCH] make loadGenerationDelay optinal --- .../config/example-benchmark-yaml-resource.yaml | 2 +- .../config/example-execution-yaml-resource.yaml | 2 +- .../main/kotlin/theodolite/benchmark/BenchmarkExecution.kt | 2 +- .../main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt | 4 ++-- .../theodolite/benchmark/KubernetesBenchmarkDeployment.kt | 6 +++--- .../main/kotlin/theodolite/execution/BenchmarkExecutor.kt | 2 +- .../kotlin/theodolite/execution/BenchmarkExecutorImpl.kt | 6 +++--- .../src/main/kotlin/theodolite/execution/Shutdown.kt | 2 +- .../main/kotlin/theodolite/execution/TheodoliteExecutor.kt | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml index ebc2fe9e4..cdc2122d9 100644 --- a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml @@ -22,7 +22,7 @@ loadTypes: - type: "NumSensorsLoadGeneratorReplicaPatcher" resource: "uc1-load-generator-deployment.yaml" kafkaConfig: - bootstrapServer: "theodolite-cp-kafka:9092" + bootstrapServer: "localhost:31290" topics: - name: "input" numPartitions: 40 diff --git a/theodolite-quarkus/config/example-execution-yaml-resource.yaml b/theodolite-quarkus/config/example-execution-yaml-resource.yaml index ccb2442d3..e0b327a02 100644 --- a/theodolite-quarkus/config/example-execution-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-execution-yaml-resource.yaml @@ -17,7 +17,7 @@ execution: strategy: "LinearSearch" duration: 300 # in seconds repetitions: 1 - delay: 30 # in seconds + loadGenerationDelay: 30 # in seconds, optional field, default is 0 seconds restrictions: - "LowerBound" configOverrides: [] diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt index f3eeaeba1..40ab663e1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt @@ -47,7 +47,7 @@ class BenchmarkExecution : CustomResource(), Namespaced { var duration by Delegates.notNull<Long>() var repetitions by Delegates.notNull<Int>() lateinit var restrictions: List<String> - var delay by Delegates.notNull<Long>() + var loadGenerationDelay = 0L } /** diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index 11cf09066..b5316a3df 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -71,7 +71,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced { load: LoadDimension, res: Resource, configurationOverrides: List<ConfigurationOverride?>, - delay: Long + loadGenerationDelay: Long ): BenchmarkDeployment { logger.info { "Using $namespace as namespace." } logger.info { "Using $path as resource path." } @@ -99,7 +99,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced { namespace = namespace, appResources = appResources.map { it.second }, loadGenResources = loadGenResources.map { it.second }, - delay = delay, + loadGenerationDelay = loadGenerationDelay, kafkaConfig = hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer), topics = kafkaConfig.topics, client = DefaultKubernetesClient().inNamespace(namespace) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt index 82e8adeb1..3d082a13c 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt @@ -25,7 +25,7 @@ class KubernetesBenchmarkDeployment( val namespace: String, val appResources: List<KubernetesResource>, val loadGenResources: List<KubernetesResource>, - private val delay: Long, + private val loadGenerationDelay: Long, private val kafkaConfig: HashMap<String, Any>, private val topics: List<KafkaConfig.TopicWrapper>, private val client: NamespacedKubernetesClient @@ -45,8 +45,8 @@ class KubernetesBenchmarkDeployment( .map { NewTopic(it.name, it.numPartitions, it.replicationFactor) } kafkaController.createTopics(kafkaTopics) appResources.forEach { kubernetesManager.deploy(it) } - logger.info { "Wait ${this.delay} seconds before starting the workload generator." } - Thread.sleep(Duration.ofSeconds(this.delay).toMillis()) + logger.info { "Wait ${this.loadGenerationDelay} seconds before starting the workload generator." } + Thread.sleep(Duration.ofSeconds(this.loadGenerationDelay).toMillis()) loadGenResources.forEach { kubernetesManager.deploy(it) } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt index 3d362e437..909ae77a9 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -27,7 +27,7 @@ abstract class BenchmarkExecutor( val configurationOverrides: List<ConfigurationOverride?>, val slo: BenchmarkExecution.Slo, val executionId: Int, - val delay: Long + val loadGenerationDelay: Long ) { var run: AtomicBoolean = AtomicBoolean(true) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index c70ab2037..22db5076b 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -21,11 +21,11 @@ class BenchmarkExecutorImpl( configurationOverrides: List<ConfigurationOverride?>, slo: BenchmarkExecution.Slo, executionId: Int, - delay: Long -) : BenchmarkExecutor(benchmark, results, executionDuration, configurationOverrides, slo, executionId, delay) { + loadGenerationDelay: Long +) : BenchmarkExecutor(benchmark, results, executionDuration, configurationOverrides, slo, executionId, loadGenerationDelay) { override fun runExperiment(load: LoadDimension, res: Resource): Boolean { var result = false - val benchmarkDeployment = benchmark.buildDeployment(load, res, configurationOverrides, delay) + val benchmarkDeployment = benchmark.buildDeployment(load, res, configurationOverrides, loadGenerationDelay) try { benchmarkDeployment.setup() diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/Shutdown.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/Shutdown.kt index c74824a4d..80e1ac234 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/Shutdown.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/Shutdown.kt @@ -31,7 +31,7 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val b load = LoadDimension(0, emptyList()), res = Resource(0, emptyList()), configurationOverrides = benchmarkExecution.configOverrides, - delay = 0L + loadGenerationDelay = 0L ) deployment.teardown() } catch (e: Exception) { diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index 00c768b2c..c297251e3 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -72,7 +72,7 @@ class TheodoliteExecutor( configurationOverrides = config.configOverrides, slo = config.slos[0], executionId = config.executionId, - delay = config.execution.delay + loadGenerationDelay = config.execution.loadGenerationDelay ) return Config( -- GitLab