[AMBARI-24464] Integrate Blueprints with the new MPackAdvisor API for Configuration Recommendations#2259
Conversation
|
Refer to this link for build results (access rights to CI server needed): |
rnettleton
left a comment
There was a problem hiding this comment.
I've taken an initial look, and the patch looks fine to me so far.
One the unit tests are available, I'll re-review.
Thanks.
| ) | ||
| ); | ||
|
|
||
| return null; |
There was a problem hiding this comment.
Shouldn't this method return the map created by the previous statement, instead of null?
There was a problem hiding this comment.
I think this is from an intermediate commit.
| } | ||
|
|
||
| private Map<String, Set<String>> gatherHostGroupBindings(ClusterTopology clusterTopology) { | ||
| Map<String, Set<String>> hgBindngs = Maps.newHashMap(); |
There was a problem hiding this comment.
Typo in hgBindngs, should be hgBindings.
| return getProperty(MPACK_ADVISOR_SCRIPT); | ||
| } | ||
|
|
||
| public boolean isUseLegacyStackAdvisor() { |
There was a problem hiding this comment.
The name shouldUseLegacyStackAdvisor would be more natural instead of isUseLegacyStackAdvisor. The latter may be OK for a JavaBean.
| */ | ||
| Stream<ResolvedComponent> getComponents(); | ||
|
|
||
| Map<String, Set<ResolvedComponent>> getComponentsByHostgroup(); |
There was a problem hiding this comment.
Group with capital G in getComponentsByHostGroup would be more in line with other methods in this interface.
| public class ExceptionUtils { | ||
|
|
||
| public interface ThrowingLambda<T extends Exception, R> { | ||
| R doIt() throws T; |
There was a problem hiding this comment.
Since T is never used (see ? extends in unchecked), I think we could get rid of this custom interface in favor of Callable.
| R doIt() throws T; | ||
| } | ||
|
|
||
| public static <R> R unchecked(ThrowingLambda<? extends Exception, R> throwingLambda) { |
| /** | ||
| * Recommend configurations by the mpack advisor, then store the results in cluster topology. | ||
| * @param clusterTopology cluster topology instance | ||
| * @param userProvidedConfigurations User configurations of cluster provided in Blueprint + Cluster template |
There was a problem hiding this comment.
I think this doc (with the exception of "mpack") belongs to the interface being implemented.
| static | ||
| { | ||
| userContext = new HashMap<>(); | ||
| userContext.put("operation", "ClusterCreate"); |
There was a problem hiding this comment.
Can be replaced with an ImmutableMap, initialized at the field declaration?
| private static MpackAdvisorHelper mpackAdvisorHelper; | ||
|
|
||
| static final String RECOMMENDATION_FAILED = "Configuration recommendation failed."; | ||
| static final String INVALID_RESPONSE = "Configuration recommendation returned with invalid response."; |
There was a problem hiding this comment.
These constants could be extracted to the interface to avoid duplication.
| Set<Component> components = entry.getValue(); | ||
| components.forEach( component -> { | ||
| Set<String> mpacksForComponent = getMpacksForComponent(component, componentNameToMpacks); | ||
| mpacksForComponent.forEach(mpack -> { |
There was a problem hiding this comment.
The way this class associates components to mpacks (and services in copyAndEnrichMpackInstances) is a bit redundant, since it's already performed by StackComponentResolver and the result is stored in ResolvedComponent instances. If some information is missing, I think it should be added there to avoid duplicated, and potentially different, implementations.
There was a problem hiding this comment.
Good catch. I've rewritten the logic to leverage ResolvedComponent's.
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
| Map<StackId, Set<String>> mpackServices = topology.getComponents().collect(toMap( | ||
| ResolvedComponent::stackId, | ||
| comp -> ImmutableSet.of(comp.serviceInfo().getName()), | ||
| (set1, set2) -> ImmutableSet.copyOf(Sets.union(set1, set2)) |
There was a problem hiding this comment.
Can be done less expensively (and perhaps more simply) by using built-ins:
Map<StackId, Set<String>> mpackServices = topology.getComponents().collect(
groupingBy(ResolvedComponent::stackId,
mapping(comp -> comp.serviceInfo().getName(), toSet())));
…nto AMBARI-24464-branch-feature-AMBARI-14714
|
Looks like many test failures are due to this change. Looking into it. |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Thanks for the changes. Please make sure to fix the remaining unit tests, if possible. |
|
Refer to this link for build results (access rights to CI server needed): |
|
retest this please |
|
Refer to this link for build results (access rights to CI server needed): |
|
retest this please |
|
Latest build failed at Python tests, and is not caused by this change, happens on the base branch, too.
|
|
Refer to this link for build results (access rights to CI server needed): |
What changes were proposed in this pull request?
This is a preview patch for mpack advisor support for blueprints. Unit tests are being written at the moment.
Mpack advisor is the new default engine for configuration recommendation. It is possible to use the legacy stack advisor though by setting use.legacy.stackadvisor=true in ambari.properties.
How was this patch tested?
Tested by manual blueprint deployment. Unit tests are being written.