Search in sources :

Example 1 with Stage

use of org.apache.helix.controller.pipeline.Stage in project helix by apache.

the class ClusterExternalViewVerifier method calculateBestPossibleState.

BestPossibleStateOutput calculateBestPossibleState(ClusterDataCache cache) throws Exception {
    ClusterEvent event = new ClusterEvent(ClusterEventType.StateVerifier);
    event.addAttribute(AttributeName.ClusterDataCache.name(), cache);
    List<Stage> stages = new ArrayList<Stage>();
    stages.add(new ResourceComputationStage());
    stages.add(new CurrentStateComputationStage());
    stages.add(new BestPossibleStateCalcStage());
    for (Stage stage : stages) {
        runStage(event, stage);
    }
    return event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.name());
}
Also used : ClusterEvent(org.apache.helix.controller.stages.ClusterEvent) ResourceComputationStage(org.apache.helix.controller.stages.ResourceComputationStage) BestPossibleStateCalcStage(org.apache.helix.controller.stages.BestPossibleStateCalcStage) ArrayList(java.util.ArrayList) BestPossibleStateCalcStage(org.apache.helix.controller.stages.BestPossibleStateCalcStage) Stage(org.apache.helix.controller.pipeline.Stage) ResourceComputationStage(org.apache.helix.controller.stages.ResourceComputationStage) CurrentStateComputationStage(org.apache.helix.controller.stages.CurrentStateComputationStage) CurrentStateComputationStage(org.apache.helix.controller.stages.CurrentStateComputationStage)

Example 2 with Stage

use of org.apache.helix.controller.pipeline.Stage in project helix by apache.

the class TaskTestUtil method calculateBestPossibleState.

public static BestPossibleStateOutput calculateBestPossibleState(ClusterDataCache cache, HelixManager manager) throws Exception {
    ClusterEvent event = new ClusterEvent(ClusterEventType.Unknown);
    event.addAttribute(AttributeName.ClusterDataCache.name(), cache);
    event.addAttribute(AttributeName.helixmanager.name(), manager);
    List<Stage> stages = new ArrayList<Stage>();
    stages.add(new ReadClusterDataStage());
    stages.add(new ResourceComputationStage());
    stages.add(new CurrentStateComputationStage());
    stages.add(new BestPossibleStateCalcStage());
    for (Stage stage : stages) {
        runStage(event, stage);
    }
    return event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.name());
}
Also used : ClusterEvent(org.apache.helix.controller.stages.ClusterEvent) ResourceComputationStage(org.apache.helix.controller.stages.ResourceComputationStage) ReadClusterDataStage(org.apache.helix.controller.stages.ReadClusterDataStage) BestPossibleStateCalcStage(org.apache.helix.controller.stages.BestPossibleStateCalcStage) ArrayList(java.util.ArrayList) BestPossibleStateCalcStage(org.apache.helix.controller.stages.BestPossibleStateCalcStage) Stage(org.apache.helix.controller.pipeline.Stage) ReadClusterDataStage(org.apache.helix.controller.stages.ReadClusterDataStage) ResourceComputationStage(org.apache.helix.controller.stages.ResourceComputationStage) CurrentStateComputationStage(org.apache.helix.controller.stages.CurrentStateComputationStage) CurrentStateComputationStage(org.apache.helix.controller.stages.CurrentStateComputationStage)

Aggregations

ArrayList (java.util.ArrayList)2 Stage (org.apache.helix.controller.pipeline.Stage)2 BestPossibleStateCalcStage (org.apache.helix.controller.stages.BestPossibleStateCalcStage)2 ClusterEvent (org.apache.helix.controller.stages.ClusterEvent)2 CurrentStateComputationStage (org.apache.helix.controller.stages.CurrentStateComputationStage)2 ResourceComputationStage (org.apache.helix.controller.stages.ResourceComputationStage)2 ReadClusterDataStage (org.apache.helix.controller.stages.ReadClusterDataStage)1