• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SupervisorDetails类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UpnpInputArgument类代码示例发布时间:2022-05-23
下一篇:
Java AbortException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap