summaryrefslogtreecommitdiff
path: root/simulator/opendc-experiments/opendc-experiments-capelin/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-08 20:46:39 +0200
committerGitHub <noreply@github.com>2021-04-08 20:46:39 +0200
commit3820ac4d31d6eb04034b85a1b53667d64ce6ba89 (patch)
treea7506b631770d6032eddc5a8252931b03c6e1796 /simulator/opendc-experiments/opendc-experiments-capelin/src/test
parent5fdbfbe7d340bc10f8b9eebd5aa23bdfd7dc4e18 (diff)
parent4f80e79b567b7d91b1086dcd74ef35616d7177f2 (diff)
compute: Implement filter scheduler
This pull request implements the filter scheduler modeled after the scheduler from [OpenStack](https://docs.openstack.org/nova/latest/user/filter-scheduler.html). The scheduler is functionally equivalent to the old allocation policies, but is more flexible and allows policies to be combined. * A new interface, `ComputeScheduler` is introduced, which is used by the `ComputeServiceImpl` to pick hosts to schedule on. * `FilterScheduler` is implemented, which works by filtering and weighing the available hosts. **Breaking API Changes** * Removal of the `AllocationPolicy` interface and its implementations. Users should migrate to the filter scheduler which offers the same functionality and more.
Diffstat (limited to 'simulator/opendc-experiments/opendc-experiments-capelin/src/test')
-rw-r--r--simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt21
1 files changed, 15 insertions, 6 deletions
diff --git a/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt b/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
index d2e7473f..4a47922d 100644
--- a/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
+++ b/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
@@ -34,7 +34,10 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertAll
import org.opendc.compute.service.driver.Host
-import org.opendc.compute.service.scheduler.AvailableCoreMemoryAllocationPolicy
+import org.opendc.compute.service.scheduler.FilterScheduler
+import org.opendc.compute.service.scheduler.filters.ComputeCapabilitiesFilter
+import org.opendc.compute.service.scheduler.filters.ComputeFilter
+import org.opendc.compute.service.scheduler.weights.CoreMemoryWeigher
import org.opendc.experiments.capelin.model.Workload
import org.opendc.experiments.capelin.monitor.ExperimentMonitor
import org.opendc.experiments.capelin.trace.Sc20ParquetTraceReader
@@ -71,7 +74,10 @@ class CapelinIntegrationTest {
val failures = false
val seed = 0
val chan = Channel<Unit>(Channel.CONFLATED)
- val allocationPolicy = AvailableCoreMemoryAllocationPolicy()
+ val allocationPolicy = FilterScheduler(
+ filters = listOf(ComputeFilter(), ComputeCapabilitiesFilter()),
+ weighers = listOf(CoreMemoryWeigher() to -1.0)
+ )
val traceReader = createTestTraceReader()
val environmentReader = createTestEnvironmentReader()
lateinit var monitorResults: ComputeMetrics
@@ -118,9 +124,9 @@ class CapelinIntegrationTest {
{ assertEquals(0, monitorResults.runningVms, "All VMs should finish after a run") },
{ assertEquals(0, monitorResults.unscheduledVms, "No VM should not be unscheduled") },
{ assertEquals(0, monitorResults.queuedVms, "No VM should not be in the queue") },
- { assertEquals(207388095207, monitor.totalRequestedBurst) { "Incorrect requested burst" } },
- { assertEquals(204745144701, monitor.totalGrantedBurst) { "Incorrect granted burst" } },
- { assertEquals(2642950497, monitor.totalOvercommissionedBurst) { "Incorrect overcommitted burst" } },
+ { assertEquals(207389912923, monitor.totalRequestedBurst) { "Incorrect requested burst" } },
+ { assertEquals(207122087280, monitor.totalGrantedBurst) { "Incorrect granted burst" } },
+ { assertEquals(267825640, monitor.totalOvercommissionedBurst) { "Incorrect overcommitted burst" } },
{ assertEquals(0, monitor.totalInterferedBurst) { "Incorrect interfered burst" } }
)
}
@@ -130,7 +136,10 @@ class CapelinIntegrationTest {
val clock = DelayControllerClockAdapter(this)
val seed = 1
val chan = Channel<Unit>(Channel.CONFLATED)
- val allocationPolicy = AvailableCoreMemoryAllocationPolicy()
+ val allocationPolicy = FilterScheduler(
+ filters = listOf(ComputeFilter(), ComputeCapabilitiesFilter()),
+ weighers = listOf(CoreMemoryWeigher() to -1.0)
+ )
val traceReader = createTestTraceReader(0.5, seed)
val environmentReader = createTestEnvironmentReader("single")