Skip to content
Snippets Groups Projects
Commit 6be9c715 authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

Make result folder configurable

parent 94d71cb5
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!122Update Theodolite Kubernetes Job,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: theodolite name: bw-theodolite
spec: spec:
template: template:
spec: spec:
...@@ -14,7 +14,7 @@ spec: ...@@ -14,7 +14,7 @@ spec:
- containerPort: 80 - containerPort: 80
name: analysis name: analysis
- name: theodolite - name: theodolite
image: ghcr.io/cau-se/theodolite:theodolite-kotlin-latest image: benediktwetzel/theodolite-test #ghcr.io/cau-se/theodolite:theodolite-kotlin-latest
imagePullPolicy: Always imagePullPolicy: Always
env: env:
- name: NAMESPACE - name: NAMESPACE
...@@ -27,6 +27,10 @@ spec: ...@@ -27,6 +27,10 @@ spec:
value: /etc/benchmark/example-benchmark-yaml-resource.yaml value: /etc/benchmark/example-benchmark-yaml-resource.yaml
- name: THEODOLITE_APP_RESOURCES - name: THEODOLITE_APP_RESOURCES
value: /etc/app-resources value: /etc/app-resources
- name: RESULTS_FOLDER
value: results
- name: CREATE_RESULTS_FOLDER
value: "true"
volumeMounts: volumeMounts:
- mountPath: "/deployments/results" - mountPath: "/deployments/results"
name: theodolite-pv-storage name: theodolite-pv-storage
......
...@@ -33,8 +33,6 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ ...@@ -33,8 +33,6 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
&& microdnf clean all \ && microdnf clean all \
&& mkdir /deployments \ && mkdir /deployments \
&& chown 1001 /deployments \ && chown 1001 /deployments \
&& mkdir deployments/results \
&& chown 777 deployments/results \
&& chmod "g+rwX" /deployments \ && chmod "g+rwX" /deployments \
&& chown 1001:root /deployments \ && chown 1001:root /deployments \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
WORKDIR /deployments WORKDIR /deployments
RUN chown 1001 /deployments \ RUN chown 1001 /deployments \
&& mkdir results \
&& chown 777 deployments/results \
&& chmod "g+rwX" /deployments \ && chmod "g+rwX" /deployments \
&& chown 1001:root /deployments && chown 1001:root /deployments
COPY --chown=1001:root build/*-runner /deployments/application COPY --chown=1001:root build/*-runner /deployments/application
......
...@@ -41,7 +41,12 @@ class AnalysisExecutor( ...@@ -41,7 +41,12 @@ class AnalysisExecutor(
query = "sum by(group)(kafka_consumergroup_group_lag >= 0)" query = "sum by(group)(kafka_consumergroup_group_lag >= 0)"
) )
CsvExporter().toCsv(name = "results/$executionId-${load.get()}-${res.get()}-${slo.sloType}", prom = prometheusData) var resultsFolder: String = System.getenv("RESULTS_FOLDER")
if (resultsFolder.isNotEmpty()){
resultsFolder += "/"
}
CsvExporter().toCsv(name = "$resultsFolder$executionId-${load.get()}-${res.get()}-${slo.sloType}", prom = prometheusData)
val sloChecker = SloCheckerFactory().create( val sloChecker = SloCheckerFactory().create(
sloType = slo.sloType, sloType = slo.sloType,
externalSlopeURL = slo.externalSloUrl, externalSlopeURL = slo.externalSloUrl,
......
...@@ -5,6 +5,7 @@ import theodolite.benchmark.BenchmarkExecution ...@@ -5,6 +5,7 @@ import theodolite.benchmark.BenchmarkExecution
import theodolite.benchmark.KubernetesBenchmark import theodolite.benchmark.KubernetesBenchmark
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
import java.lang.Exception
private val logger = KotlinLogging.logger {} private val logger = KotlinLogging.logger {}
...@@ -23,6 +24,7 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val b ...@@ -23,6 +24,7 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val b
*/ */
override fun run() { override fun run() {
// Build Configuration to teardown // Build Configuration to teardown
try {
logger.info { "Received shutdown signal -> Shutting down" } logger.info { "Received shutdown signal -> Shutting down" }
val deployment = val deployment =
benchmark.buildDeployment( benchmark.buildDeployment(
...@@ -30,8 +32,13 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val b ...@@ -30,8 +32,13 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val b
res = Resource(0, emptyList()), res = Resource(0, emptyList()),
configurationOverrides = benchmarkExecution.configOverrides configurationOverrides = benchmarkExecution.configOverrides
) )
logger.info { "Teardown everything deployed" }
deployment.teardown() deployment.teardown()
} catch (e: Exception) {
logger.warn { "Could not delete all specified resources from Kubernetes. " +
"This could be the case, if not all resources are deployed and running." }
}
logger.info { "Teardown everything deployed" }
logger.info { "Teardown completed" } logger.info { "Teardown completed" }
} }
} }
package theodolite.execution package theodolite.execution
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import mu.KotlinLogging
import theodolite.benchmark.BenchmarkExecution import theodolite.benchmark.BenchmarkExecution
import theodolite.benchmark.KubernetesBenchmark import theodolite.benchmark.KubernetesBenchmark
import theodolite.patcher.PatcherDefinitionFactory import theodolite.patcher.PatcherDefinitionFactory
...@@ -10,9 +11,17 @@ import theodolite.util.Config ...@@ -10,9 +11,17 @@ import theodolite.util.Config
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
import theodolite.util.Results import theodolite.util.Results
import java.io.File
import java.io.PrintWriter import java.io.PrintWriter
import java.lang.IllegalArgumentException
import java.lang.Thread.sleep
import java.nio.file.Files
import java.nio.file.Path
import java.time.Duration import java.time.Duration
private val logger = KotlinLogging.logger {}
/** /**
* The Theodolite executor runs all the experiments defined with the given execution and benchmark configuration. * The Theodolite executor runs all the experiments defined with the given execution and benchmark configuration.
* *
...@@ -92,13 +101,37 @@ class TheodoliteExecutor( ...@@ -92,13 +101,37 @@ class TheodoliteExecutor(
return this.kubernetesBenchmark return this.kubernetesBenchmark
} }
private fun getResultFolderString(): String {
var resultsFolder: String = System.getenv("RESULTS_FOLDER")
val createResultsFolder = System.getenv("CREATE_RESULTS_FOLDER") ?: "false"
logger.info { "RESULT_FOLDER: $resultsFolder" }
if (resultsFolder.isNotEmpty()){
resultsFolder += "/"
}
val directory = File(resultsFolder)
if (!directory.exists()) {
logger.error { "Folder $resultsFolder does not exist" }
if (createResultsFolder.toBoolean()) {
directory.mkdirs()
} else {
throw IllegalArgumentException("Result folder not found")
}
}
logger.info { "RESULT_FOLDER: $resultsFolder" }
return resultsFolder
}
/** /**
* Run all experiments which are specified in the corresponding * Run all experiments which are specified in the corresponding
* execution and benchmark objects. * execution and benchmark objects.
*/ */
fun run() { fun run() {
storeAsFile(this.config, "results/${this.config.executionId}-execution-configuration") val resultsFolder = getResultFolderString()
storeAsFile(kubernetesBenchmark, "results/${this.config.executionId}-benchmark-configuration") storeAsFile(this.config, "$resultsFolder${this.config.executionId}-execution-configuration")
storeAsFile(kubernetesBenchmark, "$resultsFolder/${this.config.executionId}-benchmark-configuration")
val config = buildConfig() val config = buildConfig()
// execute benchmarks for each load // execute benchmarks for each load
...@@ -107,7 +140,7 @@ class TheodoliteExecutor( ...@@ -107,7 +140,7 @@ class TheodoliteExecutor(
config.compositeStrategy.findSuitableResource(load, config.resources) config.compositeStrategy.findSuitableResource(load, config.resources)
} }
} }
storeAsFile(config.compositeStrategy.benchmarkExecutor.results, "results/${this.config.executionId}-result") storeAsFile(config.compositeStrategy.benchmarkExecutor.results, "$resultsFolder${this.config.executionId}-result")
} }
private fun <T> storeAsFile(saveObject: T, filename: String) { private fun <T> storeAsFile(saveObject: T, filename: String) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment