summaryrefslogtreecommitdiff
path: root/simulator/opendc-workflow/opendc-workflow-service
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-workflow/opendc-workflow-service
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-workflow/opendc-workflow-service')
-rw-r--r--simulator/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceIntegrationTest.kt11
1 files changed, 9 insertions, 2 deletions
diff --git a/simulator/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceIntegrationTest.kt b/simulator/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceIntegrationTest.kt
index 46c0d835..be59c8d2 100644
--- a/simulator/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceIntegrationTest.kt
+++ b/simulator/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceIntegrationTest.kt
@@ -35,7 +35,10 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertAll
import org.opendc.compute.service.ComputeService
-import org.opendc.compute.service.scheduler.NumberOfActiveServersAllocationPolicy
+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.ProvisionedCoresWeigher
import org.opendc.compute.simulator.SimHost
import org.opendc.format.environment.sc18.Sc18EnvironmentReader
import org.opendc.format.trace.gwf.GwfTraceReader
@@ -84,7 +87,11 @@ internal class WorkflowServiceIntegrationTest {
}
val meter = MeterProvider.noop().get("opendc-compute")
- val compute = ComputeService(coroutineContext, clock, meter, NumberOfActiveServersAllocationPolicy(), schedulingQuantum = 1000)
+ val computeScheduler = FilterScheduler(
+ filters = listOf(ComputeFilter(), ComputeCapabilitiesFilter()),
+ weighers = listOf(ProvisionedCoresWeigher() to -1.0)
+ )
+ val compute = ComputeService(coroutineContext, clock, meter, computeScheduler, schedulingQuantum = 1000)
hosts.forEach { compute.addHost(it) }