本文整理汇总了Java中backtype.storm.scheduler.SupervisorDetails类的典型用法代码示例。如果您正苦于以下问题:Java SupervisorDetails类的具体用法?Java SupervisorDetails怎么用?Java SupervisorDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SupervisorDetails类属于backtype.storm.scheduler包,在下文中一共展示了SupervisorDetails类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: supervisorExists
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
/**
* Method checks if all topologies that need assignment already have supervisor running on the node where the Offer
* comes from. Required for more accurate available resource calculation where we can exclude supervisor's demand from
* the Offer.
* Unfortunately because of WorkerSlot type is not topology agnostic, we need to exclude supervisor's resources only
* in case where ALL topologies in 'allSlotsAvailableForScheduling' method satisfy condition of supervisor existence
*
* @param offer Offer
* @param existingSupervisors Supervisors which already placed on the node for the Offer
* @param topologiesMissingAssignments Topology ids required assignment
* @return Boolean value indicating supervisor existence
*/
private boolean supervisorExists(
Offer offer, Collection<SupervisorDetails> existingSupervisors, Set<String> topologiesMissingAssignments) {
boolean alreadyExists = true;
for (String topologyId : topologiesMissingAssignments) {
String offerHost = offer.getHostname();
boolean exists = false;
for (SupervisorDetails d : existingSupervisors) {
if (d.getId().equals(MesosCommon.supervisorId(offerHost, topologyId))) {
exists = true;
}
}
alreadyExists = (alreadyExists && exists);
}
return alreadyExists;
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:28,代码来源:MesosNimbus.java
示例2: initialize
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Before
public void initialize() {
defaultScheduler = new DefaultScheduler();
Map<String, Object> mesosStormConf = new HashMap<>();
defaultScheduler.prepare(mesosStormConf);
rotatingMap = new RotatingMap<>(2);
topologiesMissingAssignments = new HashSet<>();
topologiesMissingAssignments.add("test-topology1-65-1442255385");
topologiesMissingAssignments.add("test-topology1-65-1442255385");
existingSupervisors = new ArrayList<>();
existingSupervisors.add(new SupervisorDetails(MesosCommon.supervisorId(sampleHost, "test-topology1-65-1442255385"), sampleHost, null, null));
existingSupervisors.add(new SupervisorDetails(MesosCommon.supervisorId(sampleHost, "test-topology10-65-1442255385"), sampleHost, null, null));
topologyMap = new HashMap<>();
topologyMap.put(sampleTopologyId, TestUtils.constructTopologyDetails(sampleTopologyId, 1, 0.1, 100));
topologies = new Topologies(topologyMap);
mesosWorkerSlotMap = new HashMap<>();
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:23,代码来源:DefaultSchedulerTest.java
示例3: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public Collection<WorkerSlot> allSlotsAvailableForScheduling(
Collection<SupervisorDetails> existingSupervisors, Topologies topologies, Set<String> topologiesMissingAssignments) {
synchronized (_offersLock) {
return _mesosStormScheduler.allSlotsAvailableForScheduling(
_offers,
existingSupervisors,
topologies,
topologiesMissingAssignments);
}
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:12,代码来源:MesosNimbus.java
示例4: getSpyCluster
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
private Cluster getSpyCluster() {
Map<String, SupervisorDetails> supervisors = new HashMap<>();
Map<String, SchedulerAssignmentImpl> assignmentMap = new HashMap<>();
for (SupervisorDetails supervisorDetails : existingSupervisors) {
String nodeId = supervisorDetails.getHost();
supervisors.put(nodeId, supervisorDetails);
}
return spy(new Cluster(null, supervisors, assignmentMap));
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:12,代码来源:DefaultSchedulerTest.java
示例5: testSupervisorExists
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Test
public void testSupervisorExists() throws Exception {
Collection<SupervisorDetails> existingSupervisors = new ArrayList<>();
String hostName = "host1.east";
existingSupervisors.add(new SupervisorDetails(MesosCommon.supervisorId(hostName, "test-topology1-65-1442255385"), hostName, null));
existingSupervisors.add(new SupervisorDetails(MesosCommon.supervisorId(hostName, "test-topology10-65-1442255385"), hostName, null));
assertEquals(true, SchedulerUtils.supervisorExists(hostName, existingSupervisors, "test-topology1-65-1442255385"));
assertEquals(false, SchedulerUtils.supervisorExists(hostName, existingSupervisors, "test-topology2-65-1442255385"));
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:12,代码来源:SchedulerUtilsTest.java
示例6: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public Collection<WorkerSlot> allSlotsAvailableForScheduling(
Collection<SupervisorDetails> existingSupervisors,
Topologies topologies, Set<String> topologiesMissingAssignments) {
Collection<WorkerSlot> result = new HashSet<WorkerSlot>();
for (SupervisorDetails detail : existingSupervisors) {
for (Integer port : detail.getAllPorts())
result.add(new WorkerSlot(detail.getId(), port));
}
return result;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:12,代码来源:DefaultInimbus.java
示例7: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public Collection<WorkerSlot> allSlotsAvailableForScheduling(
Collection<SupervisorDetails> existingSupervisors,
Topologies topologies, Set<String> topologiesMissingAssignments) {
// TODO Auto-generated method stub
Collection<WorkerSlot> result = new HashSet<WorkerSlot>();
for (SupervisorDetails detail : existingSupervisors) {
for (Integer port : detail.getAllPorts())
result.add(new WorkerSlot(detail.getId(), port));
}
return result;
}
开发者ID:songtk,项目名称:learn_jstorm,代码行数:13,代码来源:DefaultInimbus.java
示例8: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public Collection<WorkerSlot> allSlotsAvailableForScheduling(Collection<SupervisorDetails> existingSupervisors, Topologies topologies,
Set<String> topologiesMissingAssignments) {
// TODO Auto-generated method stub
Collection<WorkerSlot> result = new HashSet<WorkerSlot>();
for (SupervisorDetails detail : existingSupervisors) {
for (Integer port : detail.getAllPorts())
result.add(new WorkerSlot(detail.getId(), port));
}
return result;
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:12,代码来源:DefaultInimbus.java
示例9: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public Collection<WorkerSlot> allSlotsAvailableForScheduling(Collection<SupervisorDetails> existingSupervisors,
Topologies topologies,
Set<String> topologiesMissingAssignments) {
Collection<WorkerSlot> result = new HashSet<>();
for (SupervisorDetails detail : existingSupervisors) {
for (Integer port : detail.getAllPorts())
result.add(new WorkerSlot(detail.getId(), port));
}
return result;
}
开发者ID:alibaba,项目名称:jstorm,代码行数:12,代码来源:DefaultInimbus.java
示例10: getHostName
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public String getHostName(Map<String, SupervisorDetails> map, String nodeId) {
return nodeId;
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:5,代码来源:MesosNimbus.java
示例11: getHostName
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public String getHostName(
Map<String, SupervisorDetails> existingSupervisors, String nodeId) {
return null;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:6,代码来源:DefaultInimbus.java
示例12: getHostName
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public String getHostName(
Map<String, SupervisorDetails> existingSupervisors, String nodeId) {
// TODO Auto-generated method stub
return null;
}
开发者ID:songtk,项目名称:learn_jstorm,代码行数:7,代码来源:DefaultInimbus.java
示例13: getHostName
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public String getHostName(Map<String, SupervisorDetails> existingSupervisors, String nodeId) {
// TODO Auto-generated method stub
return null;
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:6,代码来源:DefaultInimbus.java
示例14: getHostName
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public String getHostName(Map<String, SupervisorDetails> map, String nodeId) {
return nodeId;
}
开发者ID:deric,项目名称:storm-mesos,代码行数:5,代码来源:MesosNimbus.java
示例15: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public Collection<WorkerSlot> allSlotsAvailableForScheduling(
Collection<SupervisorDetails> existingSupervisors, Topologies topologies, Set<String> topologiesMissingAssignments) {
synchronized (OFFERS_LOCK) {
LOG.info("Currently have " + _offers.size() + " offers buffered");
if (!topologiesMissingAssignments.isEmpty()) {
LOG.info("Topologies that need assignments: " + topologiesMissingAssignments.toString());
} else {
LOG.info("Declining offers because no topologies need assignments");
_offers.clear();
}
}
Double cpu = null;
Double mem = null;
// TODO: maybe this isn't the best approach. if a topology raises #cpus keeps failing,
// it will mess up scheduling on this cluster permanently
for (String id : topologiesMissingAssignments) {
TopologyDetails details = topologies.getById(id);
double tcpu = MesosCommon.topologyCpu(_conf, details);
double tmem = MesosCommon.topologyMem(_conf, details);
if (cpu == null || tcpu > cpu) {
cpu = tcpu;
}
if (mem == null || tmem > mem) {
mem = tmem;
}
}
// need access to how many slots are currently used to limit number of slots taken up
List<WorkerSlot> allSlots = new ArrayList();
if (cpu != null && mem != null) {
synchronized (OFFERS_LOCK) {
for (Offer offer : _offers.values()) {
allSlots.addAll(toSlots(offer, cpu, mem));
}
}
}
LOG.info("Number of available slots: " + allSlots.size());
return allSlots;
}
开发者ID:deric,项目名称:storm-mesos,代码行数:44,代码来源:MesosNimbus.java
示例16: getHostName
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
@Override
public String getHostName(Map<String, SupervisorDetails> existingSupervisors, String nodeId) {
return null;
}
开发者ID:alibaba,项目名称:jstorm,代码行数:5,代码来源:DefaultInimbus.java
示例17: allSlotsAvailableForScheduling
import backtype.storm.scheduler.SupervisorDetails; //导入依赖的package包/类
/**
* This method is invoked by Nimbus when it wants to get a list of worker slots that are available for assigning the
* topology workers. In Nimbus's view, a "WorkerSlot" is a host and port that it can use to assign a worker.
* <p/>
* TODO: Rotating Map itself needs to be refactored. Perhaps make RotatingMap inherit Map so users can pass in a
* map? or Make the IMesosStormScheduler itself generic so _offers could be of any type?
*/
public List<WorkerSlot> allSlotsAvailableForScheduling(RotatingMap<Protos.OfferID, Protos.Offer> offers,
Collection<SupervisorDetails> existingSupervisors,
Topologies topologies, Set<String> topologiesMissingAssignments);
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:11,代码来源:IMesosStormScheduler.java
注:本文中的backtype.storm.scheduler.SupervisorDetails类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论