Skip to content
Snippets Groups Projects
Commit 7f69f4cb authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

Add shutdown hook

parent 612e3f7a
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!96Handle shutdown,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
package theodolite.execution
import mu.KotlinLogging
import theodolite.benchmark.BenchmarkExecution
import theodolite.benchmark.KubernetesBenchmark
import theodolite.util.LoadDimension
import theodolite.util.Resource
private val logger = KotlinLogging.logger {}
class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val benchmark: KubernetesBenchmark) :
Thread() {
override fun run() {
// Build Configuration to teardown
logger.info { "Received shutdown signal -> Shutting down" }
val deployment =
benchmark.buildDeployment(
load = LoadDimension(0, "shutdown"),
res = Resource(0, "shutdown"),
configurationOverrides = benchmarkExecution.configOverrides
)
logger.info { "Teardown the everything deployed" }
deployment.teardown()
logger.info { "Teardown completed" }
// TODO Clear/Reset the kafka lag exporter ?
}
}
...@@ -22,6 +22,8 @@ object TheodoliteYamlExecutor { ...@@ -22,6 +22,8 @@ object TheodoliteYamlExecutor {
val benchmark = val benchmark =
parser.parse("./../../../resources/main/yaml/BenchmarkType.yaml", KubernetesBenchmark::class.java)!! parser.parse("./../../../resources/main/yaml/BenchmarkType.yaml", KubernetesBenchmark::class.java)!!
Runtime.getRuntime().addShutdownHook(Shutdown(benchmarkExecution, benchmark))
val executor = TheodoliteExecutor(benchmarkExecution, benchmark) val executor = TheodoliteExecutor(benchmarkExecution, benchmark)
executor.run() executor.run()
logger.info { "Theodolite finished" } logger.info { "Theodolite finished" }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment