diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt b/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt index 89c9ac1fe0bef683e14ed071c1c749564115d522..ef9e1a458aa39502de315d5fad4c622f3d047db5 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt @@ -2,7 +2,7 @@ package theodolite import io.quarkus.runtime.annotations.QuarkusMain import mu.KotlinLogging -import theodolite.benchmark.TheodoliteYamlExecutor +import theodolite.execution.TheodoliteYamlExecutor private val logger = KotlinLogging.logger {} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index 8f08bf282d3eca4987be23df73b0821b80253d78..fc5515a4a83b38f6fb040ebf09eb9713e5788739 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -3,7 +3,7 @@ package theodolite.benchmark import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.client.DefaultKubernetesClient import org.apache.kafka.clients.admin.NewTopic -import theodolite.k8s.YamlLoader +import theodolite.k8s.K8sResourceLoader import theodolite.patcher.PatcherManager import theodolite.util.* import java.util.* @@ -21,8 +21,8 @@ class KubernetesBenchmark(): Benchmark { private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> { val basePath = "./../../../resources/main/yaml/" - var parser = theodolite.benchmark.BenchmarkYamlParser() - val loader = YamlLoader(DefaultKubernetesClient().inNamespace("default")) + var parser = YamlParser() + val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace("default")) return resources .map { resource -> val resourcePath = "$basePath/$resource" @@ -32,9 +32,6 @@ class KubernetesBenchmark(): Benchmark { } } - - - override fun buildDeployment(load: LoadDimension, res: Resource, overrides: List<OverridePatcherDefinition>): BenchmarkDeployment { // TODO("set node selector") val resources = loadKubernetesResources(this.appResource + this.loadGenResource) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt index 3c14736915d5bd99d56d1e03b3da9feea0d3a3ed..227934a00011d73b2e1f9482e9114acbdd3a47ac 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt @@ -9,7 +9,7 @@ import theodolite.k8s.WorkloadGeneratorStateCleaner import java.util.* class KubernetesBenchmarkDeployment( - val resources: List<KubernetesResource>, // List of already patched resources + val resources: List<KubernetesResource>, private val kafkaConfig: HashMap<String, Any>, private val zookeeperConfig: String, private val topics: Collection<NewTopic> diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmark.kt new file mode 100644 index 0000000000000000000000000000000000000000..dc55d61faf0c5f1406f20b57b0df3f8cec345bd1 --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmark.kt @@ -0,0 +1,16 @@ +package theodolite.benchmark + +import theodolite.util.LoadDimension +import theodolite.util.OverridePatcherDefinition +import theodolite.util.Resource + +class TestBenchmark : Benchmark { + + override fun buildDeployment( + load: LoadDimension, + res: Resource, + override: List<OverridePatcherDefinition> + ): BenchmarkDeployment { + return TestBenchmarkDeployment() + } +} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmarkDeployment.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmarkDeployment.kt new file mode 100644 index 0000000000000000000000000000000000000000..8c86fe3175ca46147ce610c654bd118f31e566e1 --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmarkDeployment.kt @@ -0,0 +1,9 @@ +package theodolite.benchmark + +class TestBenchmarkDeployment: BenchmarkDeployment { + override fun setup() { + } + + override fun teardown() { + } +} \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteBenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteBenchmarkExecutor.kt deleted file mode 100644 index cb4f0312cfcd49a2d1e14f213d55ef8617899ce1..0000000000000000000000000000000000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteBenchmarkExecutor.kt +++ /dev/null @@ -1,46 +0,0 @@ -package theodolite.benchmark - -import theodolite.execution.BenchmarkExecutor -import theodolite.execution.BenchmarkExecutorImpl -import theodolite.strategies.StrategiesManager -import theodolite.strategies.searchstrategy.CompositeStrategy -import theodolite.util.Config -import theodolite.util.LoadDimension -import theodolite.util.Resource -import theodolite.util.Results -import java.time.Duration - -class TheodoliteBenchmarkExecutor( - private val benchmarkContext: BenchmarkContext, - private val kubernetesBenchmark: KubernetesBenchmark) -{ - - private fun buildConfig(): Config{ - val results = Results() - val strategyManager = StrategiesManager() - - val executionDuration = Duration.ofSeconds(this.benchmarkContext.execution.duration) - val executor = BenchmarkExecutorImpl(kubernetesBenchmark, results, executionDuration, this.benchmarkContext.configOverrides) - - return Config( - loads = benchmarkContext.loads.map { number -> LoadDimension(number) }, - resources = benchmarkContext.resources.map { number -> Resource(number) }, - compositeStrategy = CompositeStrategy( - benchmarkExecutor = executor, - searchStrategy = strategyManager.createSearchStrategy(executor, this.benchmarkContext.execution.strategy), - restrictionStrategies = strategyManager.createRestrictionStrategy(results, this.benchmarkContext.execution.restrictions)), - executionDuration = executionDuration) - } - - - - fun run() { - val config = buildConfig() - - // execute benchmarks for each load - for (load in config.loads) { - config.compositeStrategy.findSuitableResource(load, config.resources) - } - - } -} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/AbstractBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/AbstractBenchmark.kt similarity index 90% rename from theodolite-quarkus/src/main/kotlin/theodolite/util/AbstractBenchmark.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/deprecated/AbstractBenchmark.kt index 2411e1b8bb62bf40ed724737e76280603ab4f97b..b5dce58d4365f1b83e7a61c0cf0c519dd87be920 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/AbstractBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/AbstractBenchmark.kt @@ -1,4 +1,7 @@ -package theodolite.util +package theodolite.deprecated + +import theodolite.util.LoadDimension +import theodolite.util.Resource abstract class AbstractBenchmark(val config: Config): Benchmark { override fun start(load: LoadDimension, resources: Resource) { @@ -24,4 +27,4 @@ abstract class AbstractBenchmark(val config: Config): Benchmark { val ucImageURL: String, val wgImageURL: String ) {} -} +} \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/Benchmark.kt similarity index 71% rename from theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/deprecated/Benchmark.kt index 44f98da2ec34df02d2b010dc1844f1ffa57c0f50..57652a5b79bc678816b72df5b13a8c3e929e5d58 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/Benchmark.kt @@ -1,4 +1,7 @@ -package theodolite.util +package theodolite.deprecated + +import theodolite.util.LoadDimension +import theodolite.util.Resource interface Benchmark { fun start(load: LoadDimension, resources: Resource) { @@ -9,4 +12,4 @@ interface Benchmark { fun startSUT(resources: Resource); fun startWorkloadGenerator(load: LoadDimension) -} \ No newline at end of file +} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/ConfigMapManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/ConfigMapManager.kt similarity index 92% rename from theodolite-quarkus/src/main/kotlin/theodolite/k8s/ConfigMapManager.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/deprecated/ConfigMapManager.kt index bf18ff7df07b4eb1e13d4a8c273fecd9283be267..f9b61c40b73d90aaf57cfb12526090f07114ee08 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/ConfigMapManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/ConfigMapManager.kt @@ -1,4 +1,4 @@ -package theodolite.k8s +package theodolite.deprecated import io.fabric8.kubernetes.api.model.ConfigMap import io.fabric8.kubernetes.client.NamespacedKubernetesClient diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/ServiceManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/ServiceManager.kt similarity index 94% rename from theodolite-quarkus/src/main/kotlin/theodolite/k8s/ServiceManager.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/deprecated/ServiceManager.kt index a976849fac0e0df9d224e96f3d4d87bda1d97695..5245a00aac963934bfa940a886d2ad809052c0d6 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/ServiceManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/ServiceManager.kt @@ -1,4 +1,4 @@ -package theodolite.k8s +package theodolite.deprecated import io.fabric8.kubernetes.api.model.Service import io.fabric8.kubernetes.client.NamespacedKubernetesClient diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/TheodoliteExecutor.kt new file mode 100644 index 0000000000000000000000000000000000000000..01d1075df50d9cbf49db3e4c206410dff52293db --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/TheodoliteExecutor.kt @@ -0,0 +1,70 @@ +package theodolite.deprecated +/* +import mu.KotlinLogging +import theodolite.deprecated.AbstractBenchmark +import theodolite.k8s.UC1Benchmark +import theodolite.strategies.restriction.LowerBoundRestriction +import theodolite.strategies.searchstrategy.CompositeStrategy +import theodolite.strategies.searchstrategy.LinearSearch +import theodolite.util.* +import java.nio.file.Paths +import java.time.Duration + +private val logger = KotlinLogging.logger {} + +class TheodoliteExecutor() { + val projectDirAbsolutePath = Paths.get("").toAbsolutePath().toString() + val resourcesPath = Paths.get(projectDirAbsolutePath, "./../../../resources/main/yaml/") + private fun loadConfig(): Config { + logger.info { resourcesPath } + val benchmark: UC1Benchmark = UC1Benchmark( + AbstractBenchmark.Config( + clusterZookeeperConnectionString = "my-confluent-cp-zookeeper:2181", + clusterKafkaConnectionString = "my-confluent-cp-kafka:9092", + externalZookeeperConnectionString = "localhost:2181", + externalKafkaConnectionString = "localhost:9092", + schemaRegistryConnectionString = "http://my-confluent-cp-schema-registry:8081", + kafkaPartition = 40, + kafkaReplication = 1, + kafkaTopics = listOf("input", "output"), + // TODO("handle path in a more nice way (not absolut)") + ucDeploymentPath = "$resourcesPath/aggregation-deployment.yaml", + ucServicePath = "$resourcesPath/aggregation-service.yaml", + wgDeploymentPath = "$resourcesPath/workloadGenerator.yaml", + configMapPath = "$resourcesPath/jmx-configmap.yaml", + ucImageURL = "ghcr.io/cau-se/theodolite-uc1-kstreams-app:latest", + wgImageURL = "ghcr.io/cau-se/theodolite-uc1-workload-generator:theodolite-kotlin-latest" + ) + ) + val results: Results = Results() + + val executionDuration = Duration.ofSeconds(60 * 5) + + val executor: BenchmarkExecutor = BenchmarkExecutorImpl(benchmark, results, executionDuration) + + val restrictionStrategy = LowerBoundRestriction(results) + val searchStrategy = LinearSearch(executor) + + return Config( + loads = listOf(5000, 10000).map { number -> LoadDimension(number) }, + resources = (1..6).map { number -> Resource(number) }, + compositeStrategy = CompositeStrategy( + executor, + searchStrategy, + restrictionStrategies = setOf(restrictionStrategy) + ), + executionDuration = executionDuration + ) + } + + fun run() { + // read or get benchmark config + val config = this.loadConfig() + + // execute benchmarks for each load + for (load in config.loads) { + config.compositeStrategy.findSuitableResource(load, config.resources) + } + } +} +*/ \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/UC1Benchmark.kt similarity index 98% rename from theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/deprecated/UC1Benchmark.kt index af81e75b7f39f43e7430ae007f08dc8393eb00f7..13ff2a5b33cffaae2f7dd74e4107ba2577c17c84 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/deprecated/UC1Benchmark.kt @@ -1,12 +1,12 @@ -package theodolite.k8s - +package theodolite.deprecated +/* import io.fabric8.kubernetes.api.model.ConfigMap import io.fabric8.kubernetes.api.model.Service import io.fabric8.kubernetes.api.model.apps.Deployment import io.fabric8.kubernetes.client.DefaultKubernetesClient import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging -import theodolite.util.AbstractBenchmark +import theodolite.deprecated.AbstractBenchmark import theodolite.util.LoadDimension import theodolite.util.Resource @@ -93,5 +93,5 @@ class UC1Benchmark(config: Config) : AbstractBenchmark(config) { this.deploymentManager.setWorkloadEnv(this.wgDeployment, "workload-generator", environmentVariables) this.deploymentManager.deploy(this.wgDeployment) } - } + */ \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt index 714a27885759fa37e0dfc15e500f28b4b9e65047..c78559dd09b1314d4c147b102661622fde1ec73b 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -2,7 +2,6 @@ package theodolite.execution import mu.KotlinLogging import theodolite.benchmark.Benchmark -import theodolite.benchmark.KubernetesBenchmark import theodolite.util.* import java.time.Duration diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index c034dd6e9599949240fa0b8137c240254e21eab8..c38dd1c148c611cac1e40a9cd9308791beb9841b 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -4,7 +4,7 @@ import theodolite.benchmark.Benchmark import theodolite.util.* import java.time.Duration -class BenchmarkExecutorImpl(benchmark: Benchmark, results: Results, executionDuration: Duration, private val overrides: List<OverridePatcherDefinition>) : BenchmarkExecutor(benchmark, results, executionDuration, overrides) { +class BenchmarkExecutorImpl(benchmark: Benchmark, results: Results, executionDuration: Duration, val overrides: List<OverridePatcherDefinition>) : BenchmarkExecutor(benchmark, results, executionDuration, overrides) { override fun runExperiment(load: LoadDimension, res: Resource): Boolean { val benchmarkDeployment = benchmark.buildDeployment(load, res, this.overrides) benchmarkDeployment.setup() diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt index 66506055e67a63ae7aa7156c28c83e2186b8b960..3b1b6b31d7881533707a3aa3b50021af154ea72e 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt @@ -1,8 +1,6 @@ package theodolite.execution import theodolite.benchmark.Benchmark -import theodolite.benchmark.KubernetesBenchmark -import theodolite.util.AbstractBenchmark import theodolite.util.LoadDimension import theodolite.util.Resource import theodolite.util.Results diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index 3db21a87a4383fbeba8100f94bb13ba75bd249cf..92d9a4ed92e4bbf5b13eb159855621b3ff80d858 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -1,69 +1,47 @@ package theodolite.execution -/* -import mu.KotlinLogging -import theodolite.k8s.UC1Benchmark -import theodolite.strategies.restriction.LowerBoundRestriction + +import theodolite.benchmark.BenchmarkContext +import theodolite.benchmark.KubernetesBenchmark +import theodolite.strategies.StrategiesManager import theodolite.strategies.searchstrategy.CompositeStrategy -import theodolite.strategies.searchstrategy.LinearSearch -import theodolite.util.* -import java.nio.file.Paths +import theodolite.util.Config +import theodolite.util.LoadDimension +import theodolite.util.Resource +import theodolite.util.Results import java.time.Duration -private val logger = KotlinLogging.logger {} - -class TheodoliteExecutor() { - val projectDirAbsolutePath = Paths.get("").toAbsolutePath().toString() - val resourcesPath = Paths.get(projectDirAbsolutePath, "./../../../resources/main/yaml/") - private fun loadConfig(): Config { - logger.info { resourcesPath } - val benchmark: UC1Benchmark = UC1Benchmark( - AbstractBenchmark.Config( - clusterZookeeperConnectionString = "my-confluent-cp-zookeeper:2181", - clusterKafkaConnectionString = "my-confluent-cp-kafka:9092", - externalZookeeperConnectionString = "localhost:2181", - externalKafkaConnectionString = "localhost:9092", - schemaRegistryConnectionString = "http://my-confluent-cp-schema-registry:8081", - kafkaPartition = 40, - kafkaReplication = 1, - kafkaTopics = listOf("input", "output"), - // TODO("handle path in a more nice way (not absolut)") - ucDeploymentPath = "$resourcesPath/aggregation-deployment.yaml", - ucServicePath = "$resourcesPath/aggregation-service.yaml", - wgDeploymentPath = "$resourcesPath/workloadGenerator.yaml", - configMapPath = "$resourcesPath/jmx-configmap.yaml", - ucImageURL = "ghcr.io/cau-se/theodolite-uc1-kstreams-app:latest", - wgImageURL = "ghcr.io/cau-se/theodolite-uc1-workload-generator:theodolite-kotlin-latest" - ) - ) - val results: Results = Results() - - val executionDuration = Duration.ofSeconds(60 * 5) +class TheodoliteExecutor( + private val benchmarkContext: BenchmarkContext, + private val kubernetesBenchmark: KubernetesBenchmark +) +{ - val executor: BenchmarkExecutor = BenchmarkExecutorImpl(benchmark, results, executionDuration) + private fun buildConfig(): Config{ + val results = Results() + val strategyManager = StrategiesManager() - val restrictionStrategy = LowerBoundRestriction(results) - val searchStrategy = LinearSearch(executor) + val executionDuration = Duration.ofSeconds(this.benchmarkContext.execution.duration) + val executor = BenchmarkExecutorImpl(kubernetesBenchmark, results, executionDuration, this.benchmarkContext.configOverrides) return Config( - loads = listOf(5000, 10000).map { number -> LoadDimension(number) }, - resources = (1..6).map { number -> Resource(number) }, - compositeStrategy = CompositeStrategy( - executor, - searchStrategy, - restrictionStrategies = setOf(restrictionStrategy) - ), - executionDuration = executionDuration - ) + loads = benchmarkContext.loads.map { number -> LoadDimension(number) }, + resources = benchmarkContext.resources.map { number -> Resource(number) }, + compositeStrategy = CompositeStrategy( + benchmarkExecutor = executor, + searchStrategy = strategyManager.createSearchStrategy(executor, this.benchmarkContext.execution.strategy), + restrictionStrategies = strategyManager.createRestrictionStrategy(results, this.benchmarkContext.execution.restrictions)), + executionDuration = executionDuration) } + + fun run() { - // read or get benchmark config - val config = this.loadConfig() + val config = buildConfig() // execute benchmarks for each load for (load in config.loads) { config.compositeStrategy.findSuitableResource(load, config.resources) } + } } -*/ diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt similarity index 62% rename from theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt index e80f98de8bb8ee2f61879cf1359e1b0740bae133..4984f9bfe130569fce2e9ba30fd39607343999d1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt @@ -1,21 +1,19 @@ -package theodolite.benchmark +package theodolite.execution + +import theodolite.benchmark.BenchmarkContext +import theodolite.util.YamlParser +import theodolite.benchmark.KubernetesBenchmark class TheodoliteYamlExecutor { fun run() { // load the Benchmark context and the benchmark type - var parser = theodolite.benchmark.BenchmarkYamlParser() + var parser = YamlParser() val benchmarkContext = parser.parse("./../../../resources/main/yaml/testContext.yaml", BenchmarkContext::class.java) !! val benchmark = parser.parse("./../../../resources/main/yaml/testBenchmarkType.yaml", KubernetesBenchmark::class.java) !! // TheodoliteExecutor benchmarkContext, benchmark - val executor = TheodoliteBenchmarkExecutor(benchmarkContext, benchmark) + val executor = TheodoliteExecutor(benchmarkContext, benchmark) executor.run() - - - - System.out.println(benchmark.name) - System.out.println(benchmarkContext.name) - } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt index 3a9f64089409586eb37725c9d103ec106642f1b7..ef0c522070c954b7f3d386cb76a2a99e4bc48c60 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt @@ -21,7 +21,7 @@ class K8sManager(private val client: NamespacedKubernetesClient) { this.client.configMaps().createOrReplace(resource) is StatefulSet -> this.client.apps().statefulSets().createOrReplace(resource) - else -> throw IllegalArgumentException("Unknown kubernetes resource.") + else -> throw IllegalArgumentException("Unknown Kubernetes resource.") } } @@ -35,7 +35,7 @@ class K8sManager(private val client: NamespacedKubernetesClient) { this.client.configMaps().delete(resource) is StatefulSet -> this.client.apps().statefulSets().delete(resource) - else -> throw IllegalArgumentException("Unknown kubernetes resource.") + else -> throw IllegalArgumentException("Unknown Kubernetes resource.") } } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt similarity index 97% rename from theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt index 1624c6d4ea77e7c977f047fe84be4753cdf3e15c..e326ad3fec4a36c44e41f1c137442b8c9550ea7f 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/YamlLoader.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt @@ -11,7 +11,7 @@ import mu.KotlinLogging private val logger = KotlinLogging.logger {} -class YamlLoader(private val client: NamespacedKubernetesClient) { +class K8sResourceLoader(private val client: NamespacedKubernetesClient) { /** * Parses a Service from a servive yaml diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/Parser.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/Parser.kt index 6e0803e6d0a32d51742d8e37a153d18a8faaddbd..11e637c89fa4559433aefc43f59659fd51d1ce8e 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/Parser.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/Parser.kt @@ -1,5 +1,5 @@ package theodolite.util interface Parser { - fun <T> parse(path: String, E:Class<T>): T? //Yaml + fun <T> parse(path: String, E:Class<T>): T? } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt deleted file mode 100644 index 9f386ba8634b3104ba54be60cef220f2f3f84e66..0000000000000000000000000000000000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/TestBenchmark.kt +++ /dev/null @@ -1,48 +0,0 @@ -package theodolite.util - -import theodolite.benchmark.Benchmark -import theodolite.benchmark.BenchmarkDeployment - -class TestBenchmark : AbstractBenchmark( - AbstractBenchmark.Config( - clusterZookeeperConnectionString = "", - clusterKafkaConnectionString = "", - externalZookeeperConnectionString = "", - externalKafkaConnectionString = "", - schemaRegistryConnectionString = "", - kafkaTopics = emptyList(), - kafkaReplication = 0, - kafkaPartition = 0, - ucServicePath = "", - ucDeploymentPath = "", - wgDeploymentPath = "", - configMapPath = "", - ucImageURL = "", - wgImageURL = "" - ) -), Benchmark { - - override fun initializeClusterEnvironment() { - TODO("Not yet implemented") - } - - override fun clearClusterEnvironment() { - TODO("Not yet implemented") - } - - override fun startSUT(resources: Resource) { - TODO("Not yet implemented") - } - - override fun startWorkloadGenerator(load: LoadDimension) { - TODO("Not yet implemented") - } - - override fun buildDeployment( - load: LoadDimension, - res: Resource, - override: List<OverridePatcherDefinition> - ): BenchmarkDeployment { - TODO("Not yet implemented") - } -} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/YamlParser.kt similarity index 79% rename from theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/util/YamlParser.kt index 51e0f1aa39f655689493ae45fff43ba405738d8a..fb953a7443146423d3e4ef28e195f882db10015d 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/YamlParser.kt @@ -1,14 +1,13 @@ -package theodolite.benchmark +package theodolite.util import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.Constructor -import theodolite.util.Parser import java.io.File import java.io.FileInputStream import java.io.InputStream -class BenchmarkYamlParser: Parser { +class YamlParser: Parser { override fun <T> parse(path: String, E: Class<T>): T? { val input: InputStream = FileInputStream(File(path)) val parser = Yaml(Constructor(E)) diff --git a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml index dfc19f96727a860309ae679a7574a0b8d8e4ed9d..766422d5e5a9964096081a9e4018a2fa40e732e0 100644 --- a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml +++ b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml @@ -2,6 +2,7 @@ name: "theodolite ist cool" appResource: - "aggregation-deployment.yaml" - "aggregation-service.yaml" + - "jmx-configmap.yaml" loadGenResource: - "workloadGenerator.yaml" resourceTypes: diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt index fb98f11f212e40616e0907c2c61c71e7214c3d65..5734950375d4c45eba6fc7e1a7a40e43d501191d 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt @@ -3,12 +3,14 @@ package theodolite import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test +import theodolite.benchmark.TestBenchmark import theodolite.strategies.searchstrategy.LinearSearch import theodolite.strategies.searchstrategy.BinarySearch import theodolite.strategies.restriction.LowerBoundRestriction import theodolite.strategies.searchstrategy.CompositeStrategy import theodolite.execution.TestBenchmarkExecutorImpl import theodolite.util.* +import java.util.* @QuarkusTest class CompositeStrategyTest {