Search in sources :

Example 16 with SupervisorInfo

use of com.alibaba.jstorm.daemon.supervisor.SupervisorInfo in project jstorm by alibaba.

the class WorkerScheduler method getAvailableWorkersNum.

private int getAvailableWorkersNum(DefaultTopologyAssignContext context) {
    Map<String, SupervisorInfo> supervisors = context.getCluster();
    List<SupervisorInfo> isolationSupervisors = this.getIsolationSupervisors(context);
    int slotNum = 0;
    if (isolationSupervisors.size() != 0) {
        for (SupervisorInfo superivsor : isolationSupervisors) {
            slotNum = slotNum + superivsor.getAvailableWorkerPorts().size();
        }
    } else {
        for (Entry<String, SupervisorInfo> entry : supervisors.entrySet()) {
            slotNum = slotNum + entry.getValue().getAvailableWorkerPorts().size();
        }
    }
    return slotNum;
}
Also used : SupervisorInfo(com.alibaba.jstorm.daemon.supervisor.SupervisorInfo)

Aggregations

SupervisorInfo (com.alibaba.jstorm.daemon.supervisor.SupervisorInfo)16 Assignment (com.alibaba.jstorm.schedule.Assignment)6 FailedAssignTopologyException (com.alibaba.jstorm.utils.FailedAssignTopologyException)6 ResourceWorkerSlot (com.alibaba.jstorm.schedule.default_assign.ResourceWorkerSlot)5 HashMap (java.util.HashMap)5 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 AlreadyAliveException (backtype.storm.generated.AlreadyAliveException)3 InvalidTopologyException (backtype.storm.generated.InvalidTopologyException)3 KeyAlreadyExistsException (backtype.storm.generated.KeyAlreadyExistsException)3 KeyNotFoundException (backtype.storm.generated.KeyNotFoundException)3 NotAliveException (backtype.storm.generated.NotAliveException)3 SupervisorSummary (backtype.storm.generated.SupervisorSummary)3 TopologyAssignException (backtype.storm.generated.TopologyAssignException)3 StormClusterState (com.alibaba.jstorm.cluster.StormClusterState)3 FileNotFoundException (java.io.FileNotFoundException)3 InvalidParameterException (java.security.InvalidParameterException)3 TreeMap (java.util.TreeMap)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 TException (org.apache.thrift.TException)3