当前位置: 首页>>代码示例>>Java>>正文


Java Protos.OfferID方法代码示例

本文整理汇总了Java中org.apache.mesos.Protos.OfferID方法的典型用法代码示例。如果您正苦于以下问题:Java Protos.OfferID方法的具体用法?Java Protos.OfferID怎么用?Java Protos.OfferID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.mesos.Protos的用法示例。


在下文中一共展示了Protos.OfferID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: declinedLastOffer

import org.apache.mesos.Protos; //导入方法依赖的package包/类
/**
 * Verifies that the last offer sent to the scheduler was declined.
 */
public static Expect declinedLastOffer() {
    return new Expect() {
        @Override
        public void expect(ClusterState state, SchedulerDriver mockDriver) {
            ArgumentCaptor<Protos.OfferID> offerIdCaptor = ArgumentCaptor.forClass(Protos.OfferID.class);
            verify(mockDriver, atLeastOnce()).declineOffer(offerIdCaptor.capture(), any());
            Assert.assertEquals(state.getLastOffer().getId().getValue(), offerIdCaptor.getValue().getValue());
        }

        @Override
        public String getDescription() {
            return "Last offer was declined";
        }
    };
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:19,代码来源:Expect.java

示例2: getOfferResourcesListPerNode

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public static Map<String, List<OfferResources>> getOfferResourcesListPerNode(RotatingMap<Protos.OfferID, Protos.Offer> offers) {
  Map<String, List<OfferResources>> offerResourcesListPerNode = new HashMap<>();

  for (Protos.Offer offer : offers.values()) {
    String hostName = offer.getHostname();

    List<OfferResources> offerResourcesListForCurrentHost = offerResourcesListPerNode.get(hostName);
    OfferResources offerResources = new OfferResources(offer);
    if (offerResourcesListForCurrentHost == null) {
      offerResourcesListPerNode.put(hostName, new ArrayList<OfferResources>());
    }
    offerResourcesListPerNode.get(hostName).add(offerResources);
    log.info("Available resources at {}: {}", hostName, offerResources.toString());
  }
  return offerResourcesListPerNode;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:17,代码来源:SchedulerUtils.java

示例3: getOfferIDs

import org.apache.mesos.Protos; //导入方法依赖的package包/类
private List<Protos.OfferID> getOfferIDs(final List<VirtualMachineLease> leasesUsed) {
    List<Protos.OfferID> result = new ArrayList<>();
    for (VirtualMachineLease virtualMachineLease: leasesUsed) {
        result.add(virtualMachineLease.getOffer().getId());
    }
    return result;
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:8,代码来源:TaskLaunchScheduledService.java

示例4: launchTasks

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Deprecated
public Protos.Status launchTasks(Collection<Protos.OfferID> offerIds,
                                 Collection<Protos.TaskInfo> tasks,
                                 Protos.Filters filters) {
    // Shouldn't be used
    throw new UnknownError();
}
 
开发者ID:retz,项目名称:retz,代码行数:8,代码来源:MesosSchedulerDummyDriver.java

示例5: remove

import org.apache.mesos.Protos; //导入方法依赖的package包/类
/**
 * This method removes an offer from the queue based on its OfferID.
 */
public void remove(Protos.OfferID offerID) {
    Collection<Protos.Offer> offers = queue.parallelStream()
            .filter(offer -> offer.getId().equals(offerID))
            .collect(Collectors.toList());

    boolean removed = queue.removeAll(offers);
    if (!removed) {
        logger.warn("Attempted to remove offer: '{}' but it was not present in the queue.", offerID.getValue());
    } else {
        logger.info("Removed offer: {}", offerID.getValue());
    }
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:16,代码来源:OfferQueue.java

示例6: offerRescinded

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void offerRescinded(SchedulerDriver driver, final Protos.OfferID offerId) {
	runAsync(new Runnable() {
		@Override
		public void run() {
			MesosResourceManager.this.offerRescinded(new OfferRescinded(offerId));
		}
	});
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:MesosResourceManager.java

示例7: failedTaskCanBeRestarted

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void failedTaskCanBeRestarted() throws Exception {
    final List<Offer> offers = getOffers();
    final Protos.TaskStatus status = TaskTestUtils.generateStatus(
            taskInfo.getTaskId(),
            Protos.TaskState.TASK_FAILED);

    failureMonitor.setFailedList(taskInfo);
    launchConstrainer.setCanLaunch(true);
    stateStore.storeTasks(taskInfos);
    stateStore.storeStatus(taskInfo.getName(), status);
    stateStore.storeFrameworkId(TestConstants.FRAMEWORK_ID);
    when(offerAccepter.accept(any(), any())).thenReturn(Arrays.asList(offers.get(0).getId()));

    recoveryManager.update(status);
    final Collection<Protos.OfferID> acceptedOffers = planScheduler.resourceOffers(
            schedulerDriver,
            getOffers(),
            planCoordinator.getCandidates());

    // Verify we launched the task
    assertEquals(1, acceptedOffers.size());
    verify(offerAccepter, times(1)).accept(any(), recommendationCaptor.capture());
    assertEquals(6, recommendationCaptor.getValue().size());

    // Verify the Task is reported as failed.
    assertNotNull(recoveryManager.getPlan());
    assertNotNull(recoveryManager.getPlan().getChildren());
    assertNotNull(recoveryManager.getPlan().getChildren().get(0).getChildren());
    assertTrue(recoveryManager.getPlan().getChildren().get(0).getChildren().size() == 1);
    assertEquals("test-task-type-0:[test-task-name]",
            recoveryManager.getPlan()
                    .getChildren().get(0)
                    .getChildren().get(0)
                    .getName());
    reset(mockDeployManager);
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:38,代码来源:DefaultRecoveryPlanManagerTest.java

示例8: offerRescinded

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void offerRescinded(final SchedulerDriver schedulerDriver, final Protos.OfferID offerID) {
    log.trace("call offerRescinded: {}", offerID);
    taskScheduler.expireLease(offerID.getValue());
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:6,代码来源:SchedulerEngine.java

示例9: declineOffer

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void declineOffer(Protos.OfferID offerId) {
  ensureRunning();
  Futures.getUnchecked(driverFuture).declineOffer(offerId);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:6,代码来源:SchedulerDriverService.java

示例10: offerRescinded

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void offerRescinded(SchedulerDriver schedulerDriver, Protos.OfferID offerID) {
  logger.info("offerRescinded()");
  fenzoScheduler.expireLease(offerID.getValue());
}
 
开发者ID:yanglei99,项目名称:Mesos_Auto_Scale,代码行数:6,代码来源:FenzoScheduler.java

示例11: launchTask

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void launchTask(Protos.OfferID offerId, Protos.TaskInfo taskInfo) throws LaunchException {
  // no-op
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:5,代码来源:FakeOfferManager.java

示例12: getDeclined

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public List<Protos.OfferID> getDeclined() {
    return declined;
}
 
开发者ID:retz,项目名称:retz,代码行数:4,代码来源:MesosSchedulerDummyDriver.java

示例13: launchTasks

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Deprecated
public Protos.Status launchTasks(Collection<Protos.OfferID> offerIds,
                                 Collection<Protos.TaskInfo> taskToLaunch) {
    // Shouldn't be used
    throw new UnknownError();
}
 
开发者ID:retz,项目名称:retz,代码行数:7,代码来源:LocalSchedulerDriver.java

示例14: launchTasks

import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public Protos.Status launchTasks(
    Collection<Protos.OfferID> offerIds,
    Collection<Protos.TaskInfo> tasks) {
  return null;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:7,代码来源:FakeSchedulerDriver.java

示例15: declineOffer

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public Protos.Status declineOffer(Protos.OfferID offerID, Protos.Filters filters) {
    declined.add(offerID);
    return Protos.Status.DRIVER_RUNNING;
}
 
开发者ID:retz,项目名称:retz,代码行数:5,代码来源:LocalSchedulerDriver.java


注:本文中的org.apache.mesos.Protos.OfferID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。