Search in sources :

Example 1 with NewNodeManagerCandidates

use of com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response.NewNodeManagerCandidates in project cloudbreak by hortonworks.

the class YarnLoadEvaluatorTest method getMockYarnScalingResponse.

private YarnScalingServiceV1Response getMockYarnScalingResponse(String instanceType, int upScaleCount, int downScaleCount) {
    NewNodeManagerCandidates.Candidate candidate = new NewNodeManagerCandidates.Candidate();
    candidate.setCount(upScaleCount);
    candidate.setModelName(instanceType);
    NewNodeManagerCandidates candidates = new NewNodeManagerCandidates();
    candidates.setCandidates(List.of(candidate));
    YarnScalingServiceV1Response yarnScalingReponse = new YarnScalingServiceV1Response();
    if (upScaleCount > 0) {
        yarnScalingReponse.setNewNMCandidates(candidates);
    }
    List decommissionCandidates = new ArrayList();
    for (int i = 1; i <= downScaleCount; i++) {
        DecommissionCandidate decommissionCandidate = new DecommissionCandidate();
        decommissionCandidate.setAmCount(2);
        decommissionCandidate.setNodeId(fqdnBase + i + ":8042");
        decommissionCandidates.add(decommissionCandidate);
    }
    yarnScalingReponse.setDecommissionCandidates(Map.of("candidates", decommissionCandidates));
    return yarnScalingReponse;
}
Also used : DecommissionCandidate(com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response.DecommissionCandidate) DecommissionCandidate(com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response.DecommissionCandidate) NewNodeManagerCandidates(com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response.NewNodeManagerCandidates) YarnScalingServiceV1Response(com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

YarnScalingServiceV1Response (com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response)1 DecommissionCandidate (com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response.DecommissionCandidate)1 NewNodeManagerCandidates (com.sequenceiq.periscope.model.yarn.YarnScalingServiceV1Response.NewNodeManagerCandidates)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1