From 40fcd37fb5eb8ea33b7dea95d45cc73018ea22b8 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 29 Oct 2020 21:16:13 +0100 Subject: Support non-ObjectIds and empty traces --- .../src/main/kotlin/org/opendc/runner/web/Main.kt | 1 + .../org/opendc/runner/web/ResultProcessor.kt | 57 +++++++++++++++------- .../kotlin/org/opendc/runner/web/TopologyParser.kt | 2 +- .../src/main/resources/log4j2.xml | 4 +- 4 files changed, 43 insertions(+), 21 deletions(-) (limited to 'simulator/opendc-runner-web') 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 d21d000b..0b96db3d 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 @@ -293,6 +293,7 @@ public class RunnerCli : CliktCommand(name = "runner") { try { testScope.advanceUntilIdle() + testScope.uncaughtExceptions.forEach { it.printStackTrace() } } finally { monitor.close() } diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt index 979e5d3c..7f122cf7 100644 --- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt +++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/ResultProcessor.kt @@ -47,25 +47,46 @@ public class ResultProcessor(private val master: String, private val outputPath: try { val hostMetrics = spark.read().parquet(File(outputPath, "host-metrics/scenario_id=$id").path) val provisionerMetrics = spark.read().parquet(File(outputPath, "provisioner-metrics/scenario_id=$id").path) - val res = aggregate(hostMetrics, provisionerMetrics).first() + val res = aggregate(hostMetrics, provisionerMetrics).collectAsList() - return Result( - res.getList(1), - res.getList(2), - res.getList(3), - res.getList(4), - res.getList(5), - res.getList(6), - res.getList(7), - res.getList(8), - res.getList(9), - res.getList(10), - res.getList(11), - res.getList(12), - res.getList(13), - res.getList(14), - res.getList(15) - ) + if (res.isEmpty()) { + return Result( + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList(), + emptyList() + ) + } else { + val head = res.first() + return Result( + head.getList(1), + head.getList(2), + head.getList(3), + head.getList(4), + head.getList(5), + head.getList(6), + head.getList(7), + head.getList(8), + head.getList(9), + head.getList(10), + head.getList(11), + head.getList(12), + head.getList(13), + head.getList(14), + head.getList(15) + ) + } } finally { spark.close() } 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 0d1e96e6..80bd20f7 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 @@ -61,7 +61,7 @@ public class TopologyParser(private val collection: MongoCollection, p val random = Random(0) for (machine in fetchMachines(id)) { - val clusterId = machine.getObjectId("rack_id") + val clusterId = machine.get("rack_id").toString() val position = machine.getInteger("position") val processors = machine.getList("cpus", Document::class.java).flatMap { cpu -> diff --git a/simulator/opendc-runner-web/src/main/resources/log4j2.xml b/simulator/opendc-runner-web/src/main/resources/log4j2.xml index 16cedf34..ffc39890 100644 --- a/simulator/opendc-runner-web/src/main/resources/log4j2.xml +++ b/simulator/opendc-runner-web/src/main/resources/log4j2.xml @@ -30,7 +30,7 @@ - + @@ -39,7 +39,7 @@ - + -- cgit v1.2.3