summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator/src/main
diff options
context:
space:
mode:
authorNiels Thiele <noleu66@posteo.net>2025-07-15 15:53:37 +0200
committerGitHub <noreply@github.com>2025-07-15 15:53:37 +0200
commita5f3c19200026b9476edc39b951eb1003cff0831 (patch)
tree785201fc58893902c15d691eff252ac91f08f690 /opendc-compute/opendc-compute-simulator/src/main
parentb2dc97dc84f56174ede9f273999ade2ed059d431 (diff)
Add configurable resource distribution at host level (#355)
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src/main')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt15
1 files changed, 12 insertions, 3 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt
index 791ab692..ced38480 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt
@@ -33,8 +33,9 @@ import org.opendc.simulator.compute.power.SimPowerSource
import org.opendc.simulator.compute.power.batteries.BatteryAggregator
import org.opendc.simulator.compute.power.batteries.SimBattery
import org.opendc.simulator.engine.engine.FlowEngine
-import org.opendc.simulator.engine.graph.FlowDistributor
import org.opendc.simulator.engine.graph.FlowEdge
+import org.opendc.simulator.engine.graph.distributionPolicies.FlowDistributorFactory
+import org.opendc.simulator.engine.graph.distributionPolicies.FlowDistributorFactory.DistributionPolicy
/**
* A [ProvisioningStep] that provisions a list of hosts for a [ComputeService].
@@ -66,7 +67,11 @@ public class HostsProvisioningStep internal constructor(
simPowerSources.add(simPowerSource)
service.addPowerSource(simPowerSource)
- val hostDistributor = FlowDistributor(engine)
+ val hostDistributor =
+ FlowDistributorFactory.getFlowDistributor(
+ engine,
+ DistributionPolicy.MAX_MIN_FAIRNESS,
+ )
val carbonFragments = getCarbonFragments(cluster.powerSource.carbonTracePath)
@@ -80,7 +85,11 @@ public class HostsProvisioningStep internal constructor(
if (cluster.battery != null) {
// Create Battery Distributor
- val batteryDistributor = FlowDistributor(engine)
+ val batteryDistributor =
+ FlowDistributorFactory.getFlowDistributor(
+ engine,
+ DistributionPolicy.MAX_MIN_FAIRNESS,
+ )
FlowEdge(batteryDistributor, simPowerSource)
// Create Battery