• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SchedulerAssignment类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中backtype.storm.scheduler.SchedulerAssignment的典型用法代码示例。如果您正苦于以下问题:Java SchedulerAssignment类的具体用法?Java SchedulerAssignment怎么用?Java SchedulerAssignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SchedulerAssignment类属于backtype.storm.scheduler包,在下文中一共展示了SchedulerAssignment类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addTopology

点赞 3

import backtype.storm.scheduler.SchedulerAssignment; //导入依赖的package包/类
@Override
public void addTopology(TopologyDetails td) {
    String topId = td.getId();
    LOG.debug("Adding in Topology {}", topId);
    SchedulerAssignment assignment = _cluster.getAssignmentById(topId);
    Set<Node> assignedNodes = new HashSet<Node>();
    if (assignment != null) {
        for (WorkerSlot ws : assignment.getSlots()) {
            Node n = _nodeIdToNode.get(ws.getNodeId());
            assignedNodes.add(n);
        }
    }
    _usedNodes += assignedNodes.size();
    _topologyIdToNodes.put(topId, assignedNodes);
    _tds.put(topId, td);
    if (td.getConf().get(Config.TOPOLOGY_ISOLATED_MACHINES) != null) {
        _isolated.add(topId);
    }
}
 

开发者ID:kkllwww007,
项目名称:jstrom,
代码行数:20,
代码来源:IsolatedPool.java

示例2: addTopology

点赞 3

import backtype.storm.scheduler.SchedulerAssignment; //导入依赖的package包/类
@Override
public void addTopology(TopologyDetails td) {
    String topId = td.getId();
    LOG.debug("Adding in topology {}", topId);
    SchedulerAssignment assignment = _cluster.getAssignmentById(topId);
    Set<Node> assignedNodes = new HashSet<>();
    if (assignment != null) {
        for (WorkerSlot ws : assignment.getSlots()) {
            Node n = _nodeIdToNode.get(ws.getNodeId());
            assignedNodes.add(n);
        }
    }
    _usedNodes += assignedNodes.size();
    _topologyIdToNodes.put(topId, assignedNodes);
    _tds.put(topId, td);
    if (td.getConf().get(Config.TOPOLOGY_ISOLATED_MACHINES) != null) {
        _isolated.add(topId);
    }
}
 

开发者ID:alibaba,
项目名称:jstorm,
代码行数:20,
代码来源:IsolatedPool.java

示例3: testScheduleWithMultipleSlotsOnSameHost

点赞 2

import backtype.storm.scheduler.SchedulerAssignment; //导入依赖的package包/类
@Test
public void testScheduleWithMultipleSlotsOnSameHost() {
  Cluster spyCluster = this.getSpyCluster(3, 3);
  defaultScheduler.schedule(topologies, spyCluster);
  SchedulerAssignment schedulerAssignment = spyCluster.getAssignments()
                                                       .get(sampleTopologyId);
  Map<ExecutorDetails, WorkerSlot> executorDetailsWorkerSlotMap = schedulerAssignment.getExecutorToSlot();
  /* We expect the three unassigned executors to be spread
     across the three available worker slots */
  assertEquals(executorDetailsWorkerSlotMap.keySet().size(), 3);
  assertEquals(executorDetailsWorkerSlotMap.values().size(), 3);

  spyCluster = this.getSpyCluster(3, 6);
  defaultScheduler.schedule(topologies, spyCluster);
  executorDetailsWorkerSlotMap = spyCluster.getAssignments()
                                            .get(sampleTopologyId)
                                            .getExecutorToSlot();
  /* We expect all executors to be scheduled across the three
     available slots */
  assertEquals(executorDetailsWorkerSlotMap.keySet().size(), 6);
  int workerSlotsUsed = new HashSet<>(executorDetailsWorkerSlotMap.values()).size() ;
  assertEquals(workerSlotsUsed, 3);

  /* Lets make sure that the executors are evenly spread
     across the worker slots in a round robin fashion */
  schedulerAssignment = spyCluster.getAssignments()
                                                       .get(sampleTopologyId);
  executorDetailsWorkerSlotMap = schedulerAssignment.getExecutorToSlot();

  Map<WorkerSlot, List<ExecutorDetails>> workerSlotExecutorDetailsMap = this.getworkerSlotExecutorDetailsMap(executorDetailsWorkerSlotMap);

  for (WorkerSlot workerSlot : workerSlotExecutorDetailsMap.keySet()) {
    List<ExecutorDetails> executorDetails = workerSlotExecutorDetailsMap.get(workerSlot);
    assertEquals(3, Math.abs(executorDetails.get(0).getStartTask() - executorDetails.get(1).getEndTask()));
  }
}
 

开发者ID:PacktPublishing,
项目名称:Mastering-Mesos,
代码行数:37,
代码来源:DefaultSchedulerTest.java

示例4: addTopology

点赞 2

import backtype.storm.scheduler.SchedulerAssignment; //导入依赖的package包/类
@Override
public void addTopology(TopologyDetails td) {
    String topId = td.getId();
    LOG.debug("Adding in Topology {}", topId);
    _tds.put(topId, td);
    SchedulerAssignment assignment = _cluster.getAssignmentById(topId);
    if (assignment != null) {
        for (WorkerSlot ws : assignment.getSlots()) {
            Node n = _nodeIdToNode.get(ws.getNodeId());
            _nodes.add(n);
        }
    }
}
 

开发者ID:kkllwww007,
项目名称:jstrom,
代码行数:14,
代码来源:DefaultPool.java

示例5: canAdd

点赞 2

import backtype.storm.scheduler.SchedulerAssignment; //导入依赖的package包/类
@Override
public boolean canAdd(TopologyDetails td) {
    // Only add topologies that are not sharing nodes with other topologies
    String topId = td.getId();
    SchedulerAssignment assignment = _cluster.getAssignmentById(topId);
    if (assignment != null) {
        for (WorkerSlot ws : assignment.getSlots()) {
            Node n = _nodeIdToNode.get(ws.getNodeId());
            if (n.getRunningTopologies().size() > 1) {
                return false;
            }
        }
    }
    return true;
}
 

开发者ID:kkllwww007,
项目名称:jstrom,
代码行数:16,
代码来源:IsolatedPool.java

示例6: addTopology

点赞 2

import backtype.storm.scheduler.SchedulerAssignment; //导入依赖的package包/类
@Override
public void addTopology(TopologyDetails td) {
    String topId = td.getId();
    LOG.debug("Adding in topology {}", topId);
    _tds.put(topId, td);
    SchedulerAssignment assignment = _cluster.getAssignmentById(topId);
    if (assignment != null) {
        for (WorkerSlot ws : assignment.getSlots()) {
            Node n = _nodeIdToNode.get(ws.getNodeId());
            _nodes.add(n);
        }
    }
}
 

开发者ID:alibaba,
项目名称:jstorm,
代码行数:14,
代码来源:DefaultPool.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)