org.apache.mesos.Protos.Filters Java Examples
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: InternalSchedulerDriver.java From jesos with Apache License 2.0 | 6 votes |
@Override public Status launchTasks(final OfferID offerId, final Collection<TaskInfo> tasks) { checkNotNull(offerId, "offerId is null"); checkNotNull(tasks, "tasks is null"); if (!context.isStateMachine(DRIVER_RUNNING)) { return context.getStateMachine(); } final LaunchTasksMessage message = LaunchTasksMessage.newBuilder() .setFrameworkId(context.getFrameworkId()) .addOfferIds(offerId) .addAllTasks(tasks) .setFilters(Filters.newBuilder().build()) .build(); doLaunchTasks(message); return context.getStateMachine(); }
Example #2
Source File: InternalSchedulerDriver.java From jesos with Apache License 2.0 | 6 votes |
@Override public Status launchTasks(final OfferID offerId, final Collection<TaskInfo> tasks, final Filters filters) { checkNotNull(offerId, "offerId is null"); checkNotNull(tasks, "tasks is null"); checkNotNull(filters, "filters is null"); if (!context.isStateMachine(DRIVER_RUNNING)) { return context.getStateMachine(); } final LaunchTasksMessage message = LaunchTasksMessage.newBuilder() .setFrameworkId(context.getFrameworkId()) .addOfferIds(offerId) .addAllTasks(tasks) .setFilters(filters) .build(); doLaunchTasks(message); return context.getStateMachine(); }
Example #3
Source File: InternalSchedulerDriver.java From jesos with Apache License 2.0 | 6 votes |
@Override public Status launchTasks(final Collection<OfferID> offerIds, final Collection<TaskInfo> tasks) { checkNotNull(offerIds, "offerIds is null"); checkNotNull(tasks, "tasks is null"); if (!context.isStateMachine(DRIVER_RUNNING)) { return context.getStateMachine(); } final LaunchTasksMessage message = LaunchTasksMessage.newBuilder() .setFrameworkId(context.getFrameworkId()) .addAllOfferIds(offerIds) .addAllTasks(tasks) .setFilters(Filters.newBuilder().build()) .build(); doLaunchTasks(message); return context.getStateMachine(); }
Example #4
Source File: InternalSchedulerDriver.java From jesos with Apache License 2.0 | 6 votes |
@Override public Status launchTasks(final Collection<OfferID> offerIds, final Collection<TaskInfo> tasks, final Filters filters) { checkNotNull(offerIds, "offerIds is null"); checkNotNull(tasks, "tasks is null"); checkNotNull(filters, "filters is null"); if (!context.isStateMachine(DRIVER_RUNNING)) { return context.getStateMachine(); } final LaunchTasksMessage message = LaunchTasksMessage.newBuilder() .setFrameworkId(context.getFrameworkId()) .addAllOfferIds(offerIds) .addAllTasks(tasks) .setFilters(filters) .build(); doLaunchTasks(message); return context.getStateMachine(); }
Example #5
Source File: InternalSchedulerDriver.java From jesos with Apache License 2.0 | 6 votes |
@Override public Status declineOffer(final OfferID offerId, final Filters filters) { checkNotNull(offerId, "offerId is null"); checkNotNull(filters, "filters is null"); if (!context.isStateMachine(DRIVER_RUNNING)) { return context.getStateMachine(); } final LaunchTasksMessage message = LaunchTasksMessage.newBuilder() .setFrameworkId(context.getFrameworkId()) .addOfferIds(offerId) .setFilters(filters) .build(); doLaunchTasks(message); return context.getStateMachine(); }
Example #6
Source File: InternalSchedulerDriver.java From jesos with Apache License 2.0 | 6 votes |
@Override public Status declineOffer(final OfferID offerId) { checkNotNull(offerId, "offerId is null"); if (!context.isStateMachine(DRIVER_RUNNING)) { return context.getStateMachine(); } final LaunchTasksMessage message = LaunchTasksMessage.newBuilder() .setFrameworkId(context.getFrameworkId()) .addOfferIds(offerId) .setFilters(Filters.newBuilder().build()) .build(); doLaunchTasks(message); return context.getStateMachine(); }
Example #7
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 5 votes |
@Override public Status acceptOffers( Collection<OfferID> offerIds, Collection<Offer.Operation> operations, Filters filters) { throw new UnsupportedOperationException(); }
Example #8
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 5 votes |
@Override public Status launchTasks( Collection<OfferID> offerIds, Collection<TaskInfo> tasks, Filters filters) { throw new UnsupportedOperationException(); }
Example #9
Source File: SchedulerDriverService.java From attic-aurora with Apache License 2.0 | 5 votes |
@Override public void declineOffer(Protos.OfferID offerId, Protos.Filters filter) { ensureRunning(); OfferID convertedOfferId = ProtosConversion.convert(offerId); Filters convertedFilter = ProtosConversion.convert(filter); Futures.getUnchecked(driverFuture).declineOffer(convertedOfferId, convertedFilter); }
Example #10
Source File: SchedulerDriverService.java From attic-aurora with Apache License 2.0 | 5 votes |
@Override public void acceptOffers( Protos.OfferID offerId, Collection<Protos.Offer.Operation> operations, Protos.Filters filter) { ensureRunning(); OfferID convertedOfferId = ProtosConversion.convert(offerId); Collection<Operation> convertedOperations = Collections2.transform(operations, ProtosConversion::convert); Filters convertedFilter = ProtosConversion.convert(filter); Futures.getUnchecked(driverFuture) .acceptOffers(ImmutableList.of(convertedOfferId), convertedOperations, convertedFilter); }
Example #11
Source File: REEFScheduler.java From reef with Apache License 2.0 | 4 votes |
/** * Greedily acquire resources by launching a Mesos Task(w/ our custom MesosExecutor) on REEF Evaluator request. * Either called from onResourceRequest(for a new request) or resourceOffers(for an outstanding request). * TODO[JIRA REEF-102]: reflect priority and rack/node locality specified in resourceRequestEvent. */ private synchronized void doResourceRequest(final ResourceRequestEvent resourceRequestEvent) { int tasksToLaunchCounter = resourceRequestEvent.getResourceCount(); for (final Offer offer : this.offers.values()) { final int cpuSlots = getCpu(offer) / resourceRequestEvent.getVirtualCores().get(); final int memSlots = getMemory(offer) / resourceRequestEvent.getMemorySize().get(); final int taskNum = Math.min(Math.min(cpuSlots, memSlots), tasksToLaunchCounter); if (taskNum > 0 && satisfySlaveConstraint(resourceRequestEvent, offer)) { final List<TaskInfo> tasksToLaunch = new ArrayList<>(); tasksToLaunchCounter -= taskNum; // Launch as many MesosTasks on the same node(offer) as possible to exploit locality. for (int j = 0; j < taskNum; j++) { final String id = offer.getId().getValue() + "-" + String.valueOf(j); final String executorLaunchCommand = getExecutorLaunchCommand(id, resourceRequestEvent.getMemorySize().get()); final ExecutorInfo executorInfo = ExecutorInfo.newBuilder() .setExecutorId(ExecutorID.newBuilder() .setValue(id) .build()) .setCommand(CommandInfo.newBuilder() .setValue(executorLaunchCommand) .addUris(URI.newBuilder().setValue(reefTarUri).build()) .build()) .build(); final TaskInfo taskInfo = TaskInfo.newBuilder() .setTaskId(TaskID.newBuilder() .setValue(id) .build()) .setName(id) .setSlaveId(offer.getSlaveId()) .addResources(Resource.newBuilder() .setName("mem") .setType(Type.SCALAR) .setScalar(Value.Scalar.newBuilder() .setValue(resourceRequestEvent.getMemorySize().get()) .build()) .build()) .addResources(Resource.newBuilder() .setName("cpus") .setType(Type.SCALAR) .setScalar(Value.Scalar.newBuilder() .setValue(resourceRequestEvent.getVirtualCores().get()) .build()) .build()) .setExecutor(executorInfo) .build(); tasksToLaunch.add(taskInfo); this.executorIdToLaunchedRequests.put(id, resourceRequestEvent); } final Filters filters = Filters.newBuilder().setRefuseSeconds(0).build(); mesosMaster.launchTasks(Collections.singleton(offer.getId()), tasksToLaunch, filters); } else { mesosMaster.declineOffer(offer.getId()); } } // the offers are no longer valid(all launched or declined) this.offers.clear(); // Save leftovers that couldn't be launched outstandingRequests.add(ResourceRequestEventImpl.newBuilder() .mergeFrom(resourceRequestEvent) .setResourceCount(tasksToLaunchCounter) .build()); }
Example #12
Source File: MockSchedulerDriver.java From incubator-myriad with Apache License 2.0 | 4 votes |
@Override public Status declineOffer(OfferID offerId, Filters filters) { return null; }
Example #13
Source File: SchedulerDriverService.java From attic-aurora with Apache License 2.0 | 4 votes |
@Override public void acceptInverseOffer(Protos.OfferID offerID, Protos.Filters filter) { throw new UnsupportedOperationException("SchedulerDriver does not support inverse offers"); }
Example #14
Source File: MockSchedulerDriver.java From incubator-myriad with Apache License 2.0 | 4 votes |
@Override public Status acceptOffers(Collection<OfferID> offerIds, Collection<Operation> operations, Filters filters) { return null; }
Example #15
Source File: MockSchedulerDriver.java From incubator-myriad with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("deprecation") public Status launchTasks(OfferID offerId, Collection<TaskInfo> tasks, Filters filters) { return null; }
Example #16
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 4 votes |
@Override public Status launchTasks(OfferID offerId, Collection<TaskInfo> tasks, Filters filters) { throw new UnsupportedOperationException(); }
Example #17
Source File: FakeMaster.java From attic-aurora with Apache License 2.0 | 4 votes |
@Override public Status declineOffer(OfferID offerId, Filters filters) { assertNotStopped(); throw new UnsupportedOperationException(); }
Example #18
Source File: MockSchedulerDriver.java From incubator-myriad with Apache License 2.0 | 4 votes |
@Override public Status launchTasks(Collection<OfferID> offerIds, Collection<TaskInfo> tasks, Filters filters) { return null; }