summaryrefslogtreecommitdiff
path: root/simulator/opendc-runner-web/src/main/kotlin
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-11-11 00:51:23 +0100
committerGitHub <noreply@github.com>2020-11-11 00:51:23 +0100
commite1716ee419c218f879c046917eaeb1e566230b0e (patch)
tree399969e871ef89f427707c927ff5e65d4c14eba8 /simulator/opendc-runner-web/src/main/kotlin
parentf3f8d1d494a08a032940c6587c7865cd0ac0dd7a (diff)
parente6c36a309c7372bb0de3ae4a3277e91c1ee4913b (diff)
Merge pull request #62 from atlarge-research/bug/tutorial
Implement various fixes in preparation for tutorial
Diffstat (limited to 'simulator/opendc-runner-web/src/main/kotlin')
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/Main.kt2
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt8
2 files changed, 5 insertions, 5 deletions
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/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<Document>, 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<Document>, 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)
)
)
}