Java Code Examples for org.apache.mesos.Protos#Filters

The following examples show how to use org.apache.mesos.Protos#Filters . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OfferProcessor.java    From dcos-commons with Apache License 2.0 6 votes vote down vote up
/**
 * Decline unused {@link org.apache.mesos.Protos.Offer}s.
 *
 * @param unusedOffers  The collection of Offers to decline
 * @param refuseSeconds The number of seconds for which the offers should be refused
 */
private static void declineOffers(Collection<Protos.Offer> unusedOffers, int refuseSeconds) {
  Collection<Protos.OfferID> offerIds = unusedOffers.stream()
      .map(offer -> offer.getId())
      .collect(Collectors.toList());
  LOGGER.info("Declining {} unused offer{} for {} seconds: {}",
      offerIds.size(),
      offerIds.size() == 1 ? "" : "s",
      refuseSeconds,
      offerIds.stream().map(Protos.OfferID::getValue).collect(Collectors.toList()));

  final Protos.Filters filters = Protos.Filters.newBuilder()
      .setRefuseSeconds(refuseSeconds)
      .build();

  offerIds.forEach(offerId -> Driver.getInstance().declineOffer(offerId, filters));
}
 
Example 2
Source File: FakeSchedulerDriver.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
@Override
public Protos.Status acceptOffers(
    Collection<Protos.OfferID> offerIds,
    Collection<Protos.Offer.Operation> operations,
    Protos.Filters filters) {
  return null;
}
 
Example 3
Source File: IgniteSchedulerSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public Protos.Status launchTasks(Protos.OfferID offerId, Collection<Protos.TaskInfo> tasks,
    Protos.Filters filters) {
    launchedTask = tasks;

    return null;
}
 
Example 4
Source File: IgniteSchedulerSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public Protos.Status launchTasks(Collection<Protos.OfferID> offerIds,
    Collection<Protos.TaskInfo> tasks, Protos.Filters filters) {
    launchedTask = tasks;

    return null;
}
 
Example 5
Source File: FakeSchedulerDriver.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
@Override
public Protos.Status launchTasks(
    Protos.OfferID offerId,
    Collection<Protos.TaskInfo> tasks,
    Protos.Filters filters) {
  return null;
}
 
Example 6
Source File: SimulatedRemoteMesosSchedulerDriver.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status acceptOffers(Collection<Protos.OfferID> offerIds, Collection<Protos.Offer.Operation> operations, Protos.Filters filters) {
    throw new IllegalStateException("method not supported");
}
 
Example 7
Source File: MockSchedulerDriver.java    From cassandra-mesos-deprecated with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status launchTasks(final Collection<Protos.OfferID> offerIds, final Collection<Protos.TaskInfo> tasks, final Protos.Filters filters) {
    launchTasks = Tuple2.tuple2(offerIds, tasks);
    return Protos.Status.DRIVER_RUNNING;
}
 
Example 8
Source File: MockSchedulerDriver.java    From cassandra-mesos-deprecated with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status launchTasks(final Protos.OfferID offerId, final Collection<Protos.TaskInfo> tasks, final Protos.Filters filters) {
    return launchTasks(Collections.singleton(offerId), tasks, filters);
}
 
Example 9
Source File: AcceptOffers.java    From flink with Apache License 2.0 4 votes vote down vote up
public AcceptOffers(String hostname, Collection<Protos.OfferID> offerIds, Collection<Protos.Offer.Operation> operations, Protos.Filters filters) {
	this.hostname = hostname;
	this.offerIds = offerIds;
	this.operations = operations;
	this.filters = filters;
}
 
Example 10
Source File: IgniteSchedulerSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public Protos.Status acceptOffers(Collection<Protos.OfferID> collection,
    Collection<Protos.Offer.Operation> collection1, Protos.Filters filters) {
    return null;
}
 
Example 11
Source File: SimulatedRemoteMesosSchedulerDriver.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status declineOffer(Protos.OfferID offerId, Protos.Filters filters) {
    return declineOffer(offerId);
}
 
Example 12
Source File: AcceptOffers.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public AcceptOffers(String hostname, Collection<Protos.OfferID> offerIds, Collection<Protos.Offer.Operation> operations, Protos.Filters filters) {
	this.hostname = hostname;
	this.offerIds = offerIds;
	this.operations = operations;
	this.filters = filters;
}
 
Example 13
Source File: MockSchedulerDriver.java    From cassandra-mesos-deprecated with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status declineOffer(final Protos.OfferID offerId, final Protos.Filters filters) {
    declinedOffers.add(offerId);
    return Protos.Status.DRIVER_RUNNING;
}
 
Example 14
Source File: SimulatedLocalMesosSchedulerDriver.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public Status declineOffer(Protos.OfferID offerId, Protos.Filters filters) {
    return declineOffer(offerId);
}
 
Example 15
Source File: SimulatedLocalMesosSchedulerDriver.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public Status acceptOffers(Collection<Protos.OfferID> offerIds, Collection<Protos.Offer.Operation> operations, Protos.Filters filters) {
    throw new IllegalStateException("method not implemented");
}
 
Example 16
Source File: SimulatedLocalMesosSchedulerDriver.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public Status launchTasks(Protos.OfferID offerId, Collection<Protos.TaskInfo> tasks, Protos.Filters filters) {
    return launchTasks(Collections.singletonList(offerId), tasks, filters);
}
 
Example 17
Source File: FakeSchedulerDriver.java    From attic-aurora with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status declineOffer(
    Protos.OfferID offerId,
    Protos.Filters filters) {
  return null;
}
 
Example 18
Source File: AcceptOffers.java    From flink with Apache License 2.0 4 votes vote down vote up
public Protos.Filters filters() {
	return filters;
}
 
Example 19
Source File: AcceptOffers.java    From flink with Apache License 2.0 4 votes vote down vote up
public AcceptOffers(String hostname, Collection<Protos.OfferID> offerIds, Collection<Protos.Offer.Operation> operations, Protos.Filters filters) {
	this.hostname = hostname;
	this.offerIds = offerIds;
	this.operations = operations;
	this.filters = filters;
}
 
Example 20
Source File: AcceptOffers.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Protos.Filters filters() {
	return filters;
}