xiaoyao1991 commented on a change in pull request #3142: Validate resource
constraint (RAM and CPU) in RoundRobinPacking
URL: https://github.com/apache/incubator-heron/pull/3142#discussion_r245442507
##########
File path:
heron/packing/src/java/org/apache/heron/packing/roundrobin/RoundRobinPacking.java
##########
@@ -133,16 +142,36 @@ private PackingPlan packInternal(int numContainer,
Map<String, Integer> parallel
// Get the RAM map for every instance
Map<Integer, Map<InstanceId, ByteAmount>> instancesRamMap =
- getInstancesRamMapInContainer(roundRobinAllocation);
+ calculateInstancesResourceMapInContainer(
+ roundRobinAllocation,
+ TopologyUtils.getComponentRamMapConfig(topology),
+ getContainerRamHint(roundRobinAllocation),
+ instanceRamDefault,
+ containerRamPadding,
+ ByteAmount.ZERO,
+ NOT_SPECIFIED_BYTE_AMOUNT,
+ RAM);
+
+ // Get the CPU map for every instance
+ Map<Integer, Map<InstanceId, CPUShare>> instancesCpuMap =
+ calculateInstancesResourceMapInContainer(
+ roundRobinAllocation,
+
CPUShare.convertDoubleMapToCpuShareMap(TopologyUtils.getComponentCpuMapConfig(topology)),
+ CPUShare.fromDouble(getContainerCpuHint(roundRobinAllocation)),
+ CPUShare.fromDouble(instanceCpuDefault),
+ CPUShare.fromDouble(containerCpuPadding),
+ CPUShare.fromDouble(0.0),
+ CPUShare.fromDouble(NOT_SPECIFIED_CPU_SHARE),
+ CPU);
ByteAmount containerDiskInBytes =
getContainerDiskHint(roundRobinAllocation);
- double containerCpu = getContainerCpuHint(roundRobinAllocation);
+ double containerCpuHint = getContainerCpuHint(roundRobinAllocation);
Review comment:
It is actually used down in `calculateInstancesResourceMapInContainer` as
the `containerResHint`. It is used to validate the all instances + padding in
`roundRobinAllocation` does not exceed the `containerResHint`. It's just not
used anymore in `packingInternal`, similar to how we treated `containerRamHint`
before the change
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services