You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2022/06/25 07:06:19 UTC
[GitHub] [helix] grainier opened a new issue, #2167: WAGED simulation API doesn't provide actual reason for the assignment calculation fail
grainier opened a new issue, #2167:
URL: https://github.com/apache/helix/issues/2167
### Describe the bug
I've tried to using `HelixUtil.getTargetAssignmentForWagedFullAuto()` to check capacity availability for a resource before adding it to the cluster (refer to the below snippet). However, it ends up in a `HelixException` with `getIdealAssignmentForWagedFullAuto(): Calculation failed: Failed to compute BestPossibleState!` as the cause. Is it because the cluster doesn't have enough capacity for the resource? If so, is there a way to get actual `FAILED_TO_CALCULATE` exception propagated here, instead of having a generic cause?
### To Reproduce
```java
try {
IdealState newIS = getIdealState(resourceName);
ResourceConfig newResourceConfig = new ResourceConfig(resourceName);
// Set PARTITION_CAPACITY_MAP
Map<String, String> capacityDataMap = ImmutableMap.of("CPU", "20", "MEMORY", "60");
newResourceConfig.getRecord().setMapField(ResourceConfig.ResourceConfigProperty.PARTITION_CAPACITY_MAP.name(),
Collections.singletonMap(ResourceConfig.DEFAULT_PARTITION_KEY, OBJECT_MAPPER.writeValueAsString(capacityDataMap)));
// Read existing cluster/instances/resources info
final ZKHelixDataAccessor dataAccessor = new ZKHelixDataAccessor(CLUSTER_NAME,
new ZkBaseDataAccessor.Builder<ZNRecord>().setZkAddress(ZK_ADDRESS).build());
ClusterConfig clusterConfig = dataAccessor.getProperty(dataAccessor.keyBuilder().clusterConfig());
List<InstanceConfig> instanceConfigs = dataAccessor.getChildValues(dataAccessor.keyBuilder().instanceConfigs(), true);
List<String> liveInstances = dataAccessor.getChildNames(dataAccessor.keyBuilder().liveInstances());
List<IdealState> idealStates = dataAccessor.getChildValues(dataAccessor.keyBuilder().idealStates(), true);
List<ResourceConfig> resourceConfigs = dataAccessor.getChildValues(dataAccessor.keyBuilder().resourceConfigs(), true);
// Do we need add this?
idealStates.add(newIS);
resourceConfigs.add(newResourceConfig);
// Verify that utilResult contains the assignment for the resources added
Map<String, ResourceAssignment> utilResult = HelixUtil
.getTargetAssignmentForWagedFullAuto(ZK_ADDRESS, clusterConfig, instanceConfigs,
liveInstances, idealStates, resourceConfigs);
} catch (HelixException e) {
// Getting "getIdealAssignmentForWagedFullAuto(): Calculation failed: Failed to compute BestPossibleState!"
// means not enough capacity?
}
```
### Expected behavior
- Get actual `FAILED_TO_CALCULATE` exception propagated to the util, instead of having the generic `HelixException`.
### Additional context
- https://github.com/apache/helix/pull/1701
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org