本文整理汇总了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";
}
};
}
示例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;
}
示例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;
}
示例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();
}
示例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());
}
}
示例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));
}
});
}
示例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);
}
示例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());
}
示例9: declineOffer
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void declineOffer(Protos.OfferID offerId) {
ensureRunning();
Futures.getUnchecked(driverFuture).declineOffer(offerId);
}
示例10: offerRescinded
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void offerRescinded(SchedulerDriver schedulerDriver, Protos.OfferID offerID) {
logger.info("offerRescinded()");
fenzoScheduler.expireLease(offerID.getValue());
}
示例11: launchTask
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void launchTask(Protos.OfferID offerId, Protos.TaskInfo taskInfo) throws LaunchException {
// no-op
}
示例12: getDeclined
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public List<Protos.OfferID> getDeclined() {
return declined;
}
示例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();
}
示例14: launchTasks
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public Protos.Status launchTasks(
Collection<Protos.OfferID> offerIds,
Collection<Protos.TaskInfo> tasks) {
return null;
}
示例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;
}