From efd57bc38aafdbaebe7978fcb3428fa8b0eabd0c Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 11 Nov 2020 00:08:13 +0100 Subject: Add support for simulator error reporting via Sentry --- simulator/opendc-runner-web/build.gradle.kts | 4 ++-- .../src/main/kotlin/org/opendc/runner/web/Main.kt | 2 +- simulator/opendc-runner-web/src/main/resources/log4j2.xml | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'simulator') diff --git a/simulator/opendc-runner-web/build.gradle.kts b/simulator/opendc-runner-web/build.gradle.kts index a46e430f..7ae3c641 100644 --- a/simulator/opendc-runner-web/build.gradle.kts +++ b/simulator/opendc-runner-web/build.gradle.kts @@ -29,7 +29,7 @@ plugins { } application { - mainClassName = "org.opendc.runner.web.MainKt" + mainClass.set("org.opendc.runner.web.MainKt") } dependencies { @@ -45,7 +45,7 @@ dependencies { implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8") { exclude("org.jetbrains.kotlin", module = "kotlin-reflect") } - + implementation("io.sentry:sentry-log4j2:3.1.1") implementation("org.mongodb:mongodb-driver-sync:4.0.5") runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.13.1") diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt index 80b3bb20..6369fdd8 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt @@ -325,7 +325,7 @@ public class RunnerCli : CliktCommand(name = "runner") { logger.info { "Successfully finished scenario $id" } } catch (e: Exception) { - logger.warn(e) { "Scenario failed to finish" } + logger.error(e) { "Scenario failed to finish" } manager.fail(id) } finally { heartbeat.cancel() diff --git a/simulator/opendc-runner-web/src/main/resources/log4j2.xml b/simulator/opendc-runner-web/src/main/resources/log4j2.xml index 87179332..503bc5dc 100644 --- a/simulator/opendc-runner-web/src/main/resources/log4j2.xml +++ b/simulator/opendc-runner-web/src/main/resources/log4j2.xml @@ -23,21 +23,26 @@ ~ SOFTWARE. --> - + + + + + - - + + + -- cgit v1.2.3 From e6c36a309c7372bb0de3ae4a3277e91c1ee4913b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 11 Nov 2020 00:12:17 +0100 Subject: Take into account energy consumption of CPUs in topology --- .../src/main/kotlin/org/opendc/runner/web/TopologyParser.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'simulator') diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt index 80bd20f7..8bd1eefb 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt @@ -81,6 +81,9 @@ public class TopologyParser(private val collection: MongoCollection, p memory.get("sizeMb", Number::class.java).toLong() ) } + + val energyConsumptionW = machine.getList("cpus", Document::class.java).sumBy { it.getInteger("energyConsumptionW") }.toDouble() + nodes.add( SimBareMetalDriver( coroutineScope, @@ -89,10 +92,7 @@ public class TopologyParser(private val collection: MongoCollection, p "node-$clusterId-$position", mapOf(NODE_CLUSTER to clusterId), SimMachineModel(processors, memoryUnits), - // For now we assume a simple linear load model with an idle draw of ~200W and a maximum - // power draw of 350W. - // Source: https://stackoverflow.com/questions/6128960 - LinearLoadPowerModel(200.0, 350.0) + LinearLoadPowerModel(energyConsumptionW, 2 * energyConsumptionW) ) ) } -- cgit v1.2.3