Tabnine Logo
Protos$Offer.getId
Code IndexAdd Tabnine to your IDE (free)

How to use
getId
method
in
org.apache.mesos.v1.Protos$Offer

Best Java code snippets using org.apache.mesos.v1.Protos$Offer.getId (Showing top 19 results out of 315)

origin: HubSpot/Singularity

private void declineOffer(CachedOffer offer) {
 if (!schedulerClient.isRunning()) {
  LOG.error("No active scheduler driver present to handle expired offer {} - this should never happen", offer.offerId);
  return;
 }
 schedulerClient.decline(Collections.singletonList(offer.offer.getId()));
 LOG.debug("Declined cached offer {}", offer.offerId);
}
origin: HubSpot/Singularity

List<CachedOffer> cachedOffersFromHolder = offerHolder.getOffers().stream().map((o) -> offerIdToCachedOffer.get(o.getId().getValue())).collect(Collectors.toList());
 List<CachedOffer> unusedCachedOffers = unusedOffers.stream().map((o) -> offerIdToCachedOffer.get(o.getId().getValue())).collect(Collectors.toList());
 unusedCachedOffers.forEach((cachedOffer) -> {
  offerIdToCachedOffer.remove(cachedOffer.getOfferId());
origin: HubSpot/Singularity

@Override
public void cacheOffer(long timestamp, Offer offer) {
 schedulerClient.decline(Collections.singletonList(offer.getId()));
}
origin: com.hubspot/SingularityService

LOG.debug("Received offer ID {} with roles {} from {} ({}) for {} cpu(s), {} memory, {} ports, and {} disk", offer.getId().getValue(), rolesInfo, offer.getHostname(), offer.getAgentId().getValue(), MesosUtils.getNumCpus(offer), MesosUtils.getMemory(offer),
  MesosUtils.getNumPorts(offer), MesosUtils.getDisk(offer));
 mesosSchedulerClient.decline(Collections.singletonList(offer.getId()));
 offersToCheck.remove(offer);
 LOG.debug("Will decline offer {}, slave {} is not currently in a state to launch tasks", offer.getId().getValue(), offer.getHostname());
   if (cachedOffers.containsKey(o.getId().getValue())) {
    offerCache.returnOffer(cachedOffers.remove(o.getId().getValue()));
   } else {
    offerCache.cacheOffer(start, o);
  offersAcceptedFromSlave.removeAll(leftoverOffers);
  offersAcceptedFromSlave.stream()
    .filter((offer) -> cachedOffers.containsKey(offer.getId().getValue()))
    .map((o) -> cachedOffers.remove(o.getId().getValue()))
    .forEach(offerCache::useOffer);
  acceptedOffers.addAll(offersAcceptedFromSlave.stream().map(Offer::getId).collect(Collectors.toList()));
 } else {
  offerHolder.getOffers().forEach((o) -> {
   if (cachedOffers.containsKey(o.getId().getValue())) {
    offerCache.returnOffer(cachedOffers.remove(o.getId().getValue()));
   } else {
    offerCache.cacheOffer(start, o);
  .filter((o) -> !acceptedOffers.contains(o.getId()) && !cachedOffers.containsKey(o.getId().getValue()))
  .map(Offer::getId)
  .collect(Collectors.toList()));
origin: com.hubspot/SingularityService

List<CachedOffer> cachedOffersFromHolder = offerHolder.getOffers().stream().map((o) -> offerIdToCachedOffer.get(o.getId().getValue())).collect(Collectors.toList());
 List<CachedOffer> unusedCachedOffers = unusedOffers.stream().map((o) -> offerIdToCachedOffer.get(o.getId().getValue())).collect(Collectors.toList());
 unusedCachedOffers.forEach((cachedOffer) -> {
  offerIdToCachedOffer.remove(cachedOffer.getOfferId());
origin: mesosphere/mesos-rxjava

final List<OfferID> ids = newArrayList(offer.getId());
origin: com.hubspot/SingularityService

taskIds.add(taskHolder.getTask().getTaskId());
toLaunch.add(taskHolder.getMesosTask());
LOG.debug("Launching {} with offer {}", taskHolder.getTask().getTaskId(), offers.get(0).getId());
LOG.trace("Launching {} mesos task: {}", taskHolder.getTask().getTaskId(), MesosUtils.formatForLogging(taskHolder.getMesosTask()));
   offer.getId().getValue(), offer.getHostname(), MesosUtils.getNumCpus(offer), MesosUtils.getMemory(offer), MesosUtils.getDisk(offer)
 );
 currentResources = MesosUtils.subtractResources(currentResources, offer.getResourcesList());
origin: com.hubspot/SingularityService

@Test
public void testOfferCacheRescindOffers() {
 configuration.setCacheOffers(true);
 configuration.setOfferCacheSize(2);
 List<Offer> offers2 = resourceOffers(); // cached as well
 sms.rescind(offers2.get(0).getId());
 sms.rescind(offers2.get(1).getId());
 initRequest();
 initFirstDeploy();
 requestResource.postRequest(request.toBuilder().setSlavePlacement(Optional.of(SlavePlacement.SEPARATE)).setInstances(Optional.of(2)).build(), singularityUser);
 schedulerPoller.runActionOnPoll();
 Assert.assertEquals(0, taskManager.getActiveTasks().size());
 resourceOffers();
 int numTasks = taskManager.getActiveTasks().size();
 Assert.assertEquals(2, numTasks);
 startAndDeploySecondRequest();
 schedulerPoller.runActionOnPoll();
 Assert.assertEquals(numTasks, taskManager.getActiveTasks().size());
 resourceOffers();
 Assert.assertTrue(taskManager.getActiveTasks().size() > numTasks);
}
origin: com.hubspot/SingularityService

@Test
public void testOfferCache() {
 configuration.setCacheOffers(true);
 configuration.setOfferCacheSize(2);
 List<Offer> offers2 = resourceOffers();
 sms.rescind(offers2.get(0).getId());
 initRequest();
 initFirstDeploy();
 requestResource.postRequest(request.toBuilder().setSlavePlacement(Optional.of(SlavePlacement.SEPARATE)).setInstances(Optional.of(2)).build(), singularityUser);
 schedulerPoller.runActionOnPoll();
 Assert.assertEquals(1, taskManager.getActiveTasks().size());
 resourceOffers();
 Assert.assertEquals(2, taskManager.getActiveTasks().size());
}
origin: com.hubspot/SingularityService

@Override
public void cacheOffer(long timestamp, Offer offer) {
 schedulerClient.decline(Collections.singletonList(offer.getId()));
}
origin: com.hubspot/SingularityService

private void declineOffer(CachedOffer offer) {
 if (!schedulerClient.isRunning()) {
  LOG.error("No active scheduler driver present to handle expired offer {} - this should never happen", offer.offerId);
  return;
 }
 schedulerClient.decline(Collections.singletonList(offer.offer.getId()));
 LOG.debug("Declined cached offer {}", offer.offerId);
}
origin: com.hubspot/SingularityService

public CachedOffer(Offer offer) {
 this.offerId = offer.getId().getValue();
 this.offer = offer;
 this.offerState = OfferState.AVAILABLE;
}
origin: com.hubspot/SingularityService

@Override
public void cacheOffer(long timestamp, Offer offer) {
 if (!useOfferCache.get()) {
  schedulerClient.decline(Collections.singletonList(offer.getId()));
  return;
 }
 LOG.debug("Caching offer {} for {}", offer.getId().getValue(), JavaUtils.durationFromMillis(configuration.getCacheOffersForMillis()));
 offerCache.put(offer.getId().getValue(), new CachedOffer(offer));
}
origin: HubSpot/Singularity

LOG.debug("Received offer ID {} with roles {} from {} ({}) for {} cpu(s), {} memory, {} ports, and {} disk", offer.getId().getValue(), rolesInfo, offer.getHostname(), offer.getAgentId().getValue(), MesosUtils.getNumCpus(offer), MesosUtils.getMemory(offer),
  MesosUtils.getNumPorts(offer), MesosUtils.getDisk(offer));
 mesosSchedulerClient.decline(Collections.singletonList(offer.getId()));
 offersToCheck.remove(offer);
 LOG.debug("Will decline offer {}, slave {} is not currently in a state to launch tasks", offer.getId().getValue(), offer.getHostname());
   if (cachedOffers.containsKey(o.getId().getValue())) {
    offerCache.returnOffer(cachedOffers.remove(o.getId().getValue()));
   } else {
    offerCache.cacheOffer(start, o);
  offersAcceptedFromSlave.removeAll(leftoverOffers);
  offersAcceptedFromSlave.stream()
    .filter((offer) -> cachedOffers.containsKey(offer.getId().getValue()))
    .map((o) -> cachedOffers.remove(o.getId().getValue()))
    .forEach(offerCache::useOffer);
  acceptedOffers.addAll(offersAcceptedFromSlave.stream().map(Offer::getId).collect(Collectors.toList()));
 } else {
  offerHolder.getOffers().forEach((o) -> {
   if (cachedOffers.containsKey(o.getId().getValue())) {
    offerCache.returnOffer(cachedOffers.remove(o.getId().getValue()));
   } else {
    offerCache.cacheOffer(start, o);
  .filter((o) -> !acceptedOffers.contains(o.getId()) && !cachedOffers.containsKey(o.getId().getValue()))
  .map(Offer::getId)
  .collect(Collectors.toList()));
origin: HubSpot/Singularity

taskIds.add(taskHolder.getTask().getTaskId());
toLaunch.add(taskHolder.getMesosTask());
LOG.debug("Launching {} with offer {}", taskHolder.getTask().getTaskId(), offers.get(0).getId());
LOG.trace("Launching {} mesos task: {}", taskHolder.getTask().getTaskId(), MesosUtils.formatForLogging(taskHolder.getMesosTask()));
   offer.getId().getValue(), offer.getHostname(), MesosUtils.getNumCpus(offer), MesosUtils.getMemory(offer), MesosUtils.getDisk(offer)
 );
 currentResources = MesosUtils.subtractResources(currentResources, offer.getResourcesList());
origin: HubSpot/Singularity

@Test
public void testOfferCacheRescindOffers() {
 configuration.setCacheOffers(true);
 configuration.setOfferCacheSize(2);
 List<Offer> offers2 = resourceOffers(); // cached as well
 sms.rescind(offers2.get(0).getId());
 sms.rescind(offers2.get(1).getId());
 initRequest();
 initFirstDeploy();
 requestResource.postRequest(request.toBuilder().setSlavePlacement(Optional.of(SlavePlacement.SEPARATE)).setInstances(Optional.of(2)).build(), singularityUser);
 schedulerPoller.runActionOnPoll();
 Assert.assertEquals(0, taskManager.getActiveTasks().size());
 resourceOffers();
 int numTasks = taskManager.getActiveTasks().size();
 Assert.assertEquals(2, numTasks);
 startAndDeploySecondRequest();
 schedulerPoller.runActionOnPoll();
 Assert.assertEquals(numTasks, taskManager.getActiveTasks().size());
 resourceOffers();
 Assert.assertTrue(taskManager.getActiveTasks().size() > numTasks);
}
origin: HubSpot/Singularity

@Test
public void testOfferCache() {
 configuration.setCacheOffers(true);
 configuration.setOfferCacheSize(2);
 List<Offer> offers2 = resourceOffers();
 sms.rescind(offers2.get(0).getId());
 initRequest();
 initFirstDeploy();
 requestResource.postRequest(request.toBuilder().setSlavePlacement(Optional.of(SlavePlacement.SEPARATE)).setInstances(Optional.of(2)).build(), singularityUser);
 schedulerPoller.runActionOnPoll();
 Assert.assertEquals(1, taskManager.getActiveTasks().size());
 resourceOffers();
 Assert.assertEquals(2, taskManager.getActiveTasks().size());
}
origin: HubSpot/Singularity

public CachedOffer(Offer offer) {
 this.offerId = offer.getId().getValue();
 this.offer = offer;
 this.offerState = OfferState.AVAILABLE;
}
origin: HubSpot/Singularity

@Override
public void cacheOffer(long timestamp, Offer offer) {
 if (!useOfferCache.get()) {
  schedulerClient.decline(Collections.singletonList(offer.getId()));
  return;
 }
 LOG.debug("Caching offer {} for {}", offer.getId().getValue(), JavaUtils.durationFromMillis(configuration.getCacheOffersForMillis()));
 offerCache.put(offer.getId().getValue(), new CachedOffer(offer));
}
org.apache.mesos.v1Protos$OffergetId

Popular methods of Protos$Offer

  • getAgentId
  • getResourcesList
  • getHostname
  • newBuilder
  • getAttributesList
  • getDefaultInstance
  • isInitialized

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • BoxLayout (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now