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

Use logger statements instead of prints

parent 53128498
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus,!78Resolve "Implement Quarkus/Kotlin protype"
package theodolite.execution
import mu.KotlinLogging
import theodolite.execution.BenchmarkExecutor
import theodolite.util.Benchmark
import theodolite.util.LoadDimension
......@@ -13,8 +14,6 @@ class TestBenchmarkExecutor(private val mockResults: Array<Array<Boolean>>, benc
override fun runExperiment(load: LoadDimension, res: Resource): Boolean {
val result = this.mockResults[load.get()][res.get()]
System.out.println("load :" + load.get().toString() + ", res: " + res.get().toString() + ", res: " + result)
this.results.setResult(Pair(load, res), result)
return result;
}
......
package theodolite.execution
import mu.KotlinLogging
import theodolite.k8s.UC1Benchmark
import theodolite.strategies.restriction.LowerBoundRestriction
import theodolite.strategies.searchstrategy.CompositeStrategy
......@@ -7,6 +8,8 @@ import theodolite.strategies.searchstrategy.LinearSearch
import theodolite.util.*
import java.time.Duration
private val logger = KotlinLogging.logger {}
class TheodoliteExecutor() {
private fun loadConfig(): Config {
val benchmark: UC1Benchmark = UC1Benchmark(
......
package theodolite.k8s
import mu.KotlinLogging
import org.apache.kafka.clients.admin.AdminClient
import org.apache.kafka.clients.admin.AdminClientConfig
import org.apache.kafka.clients.admin.ListTopicsResult
import org.apache.kafka.clients.admin.NewTopic
private val logger = KotlinLogging.logger {}
class TopicManager(boostrapIp: String) {
val props = hashMapOf<String, Any>(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG to boostrapIp)
lateinit var kafkaAdmin: AdminClient
......@@ -13,7 +16,7 @@ class TopicManager(boostrapIp: String) {
try {
kafkaAdmin = AdminClient.create(props)
} catch (e: Exception) {
System.out.println(e.toString())
logger.error {e.toString()}
}
}
......@@ -25,7 +28,7 @@ class TopicManager(boostrapIp: String) {
newTopics.add(tops)
}
kafkaAdmin.createTopics(newTopics)
System.out.println("Topics created")
logger.info {"Topics created"}
}
fun createTopics(topics: List<String>, numPartitions: Int, replicationfactor: Short) {
......@@ -36,7 +39,7 @@ class TopicManager(boostrapIp: String) {
newTopics.add(tops)
}
kafkaAdmin.createTopics(newTopics)
System.out.println("Creation of $topics started")
logger.info {"Creation of $topics started"}
}
fun deleteTopics(topics: List<String>) {
......@@ -46,9 +49,9 @@ class TopicManager(boostrapIp: String) {
try {
result.all().get()
} catch (ex: Exception) {
System.out.println(ex.toString())
logger.error {ex.toString()}
}
System.out.println("Topics deleted")
logger.info {"Topics deleted"}
}
fun getTopics(): ListTopicsResult? {
......
package theodolite.k8s
import mu.KotlinLogging
import org.apache.zookeeper.KeeperException
import org.apache.zookeeper.WatchedEvent
import org.apache.zookeeper.Watcher
import org.apache.zookeeper.ZooKeeper
private val logger = KotlinLogging.logger {}
class WorkloadGeneratorStateCleaner(ip: String) {
val path = "/workload-generation"
val sessionTimeout = 60
......@@ -16,7 +20,7 @@ class WorkloadGeneratorStateCleaner(ip: String) {
val watcher: Watcher = ZookeperWatcher() // defined below
zookeeperClient = ZooKeeper(ip, sessionTimeout, watcher)
} catch (e: Exception) {
System.out.println(e.toString())
logger.error {e.toString()}
}
}
......@@ -28,7 +32,7 @@ class WorkloadGeneratorStateCleaner(ip: String) {
try {
zookeeperClient.delete(path, -1)
} catch (ex: Exception) {
System.out.println(ex.toString())
logger.error {ex.toString()}
}
try {
......@@ -42,15 +46,15 @@ class WorkloadGeneratorStateCleaner(ip: String) {
deleted = true
}
is InterruptedException -> {
System.out.println(ex.toString())
logger.error {ex.toString()}
}
}
}
Thread.sleep(retryTime)
System.out.println("ZooKeeper reset was not successful. Retrying in 5s")
logger.info {"ZooKeeper reset was not successful. Retrying in 5s"}
}
System.out.println("ZooKeeper reset was successful")
logger.info {"ZooKeeper reset was successful"}
}
private class ZookeperWatcher : Watcher {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment