Apache Mesos
allocator.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
18 #define __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
19 
21 
22 #include <process/dispatch.hpp>
23 #include <process/future.hpp>
24 #include <process/process.hpp>
25 
26 #include <stout/hashmap.hpp>
27 #include <stout/try.hpp>
28 
29 namespace mesos {
30 namespace internal {
31 namespace master {
32 namespace allocator {
33 
35 
36 // A wrapper for Process-based allocators. It redirects all function
37 // invocations to the underlying AllocatorProcess and manages its
38 // lifetime. We ensure the template parameter AllocatorProcess
39 // implements MesosAllocatorProcess by storing a pointer to it.
40 template <typename AllocatorProcess>
42 {
43 public:
44  // Factory to allow for typed tests.
46 
47  ~MesosAllocator() override;
48 
49  void initialize(
50  const Duration& allocationInterval,
51  const lambda::function<
52  void(const FrameworkID&,
53  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
54  offerCallback,
55  const lambda::function<
56  void(const FrameworkID&,
58  inverseOfferCallback,
59  const Option<std::set<std::string>>&
60  fairnessExcludeResourceNames = None(),
61  bool filterGpuResources = true,
62  const Option<DomainInfo>& domain = None(),
63  const Option<std::vector<Resources>>& minAllocatableResources = None())
64  override;
65 
66  void recover(
67  const int expectedAgentCount,
68  const hashmap<std::string, Quota>& quotas) override;
69 
70  void addFramework(
71  const FrameworkID& frameworkId,
72  const FrameworkInfo& frameworkInfo,
73  const hashmap<SlaveID, Resources>& used,
74  bool active,
75  const std::set<std::string>& suppressedRoles) override;
76 
77  void removeFramework(
78  const FrameworkID& frameworkId) override;
79 
80  void activateFramework(
81  const FrameworkID& frameworkId) override;
82 
84  const FrameworkID& frameworkId) override;
85 
86  void updateFramework(
87  const FrameworkID& frameworkId,
88  const FrameworkInfo& frameworkInfo,
89  const std::set<std::string>& suppressedRoles) override;
90 
91  void addSlave(
92  const SlaveID& slaveId,
93  const SlaveInfo& slaveInfo,
94  const std::vector<SlaveInfo::Capability>& capabilities,
96  const Resources& total,
97  const hashmap<FrameworkID, Resources>& used) override;
98 
99  void removeSlave(
100  const SlaveID& slaveId) override;
101 
102  void updateSlave(
103  const SlaveID& slave,
104  const SlaveInfo& slaveInfo,
105  const Option<Resources>& total = None(),
106  const Option<std::vector<SlaveInfo::Capability>>& capabilities = None())
107  override;
108 
109  void addResourceProvider(
110  const SlaveID& slave,
111  const Resources& total,
112  const hashmap<FrameworkID, Resources>& used) override;
113 
114  void activateSlave(
115  const SlaveID& slaveId) override;
116 
117  void deactivateSlave(
118  const SlaveID& slaveId) override;
119 
120  void updateWhitelist(
121  const Option<hashset<std::string>>& whitelist) override;
122 
123  void requestResources(
124  const FrameworkID& frameworkId,
125  const std::vector<Request>& requests) override;
126 
127  void updateAllocation(
128  const FrameworkID& frameworkId,
129  const SlaveID& slaveId,
130  const Resources& offeredResources,
131  const std::vector<ResourceConversion>& conversions) override;
132 
134  const SlaveID& slaveId,
135  const std::vector<Offer::Operation>& operations) override;
136 
138  const SlaveID& slaveId,
139  const Option<Unavailability>& unavailability) override;
140 
141  void updateInverseOffer(
142  const SlaveID& slaveId,
143  const FrameworkID& frameworkId,
144  const Option<UnavailableResources>& unavailableResources,
146  const Option<Filters>& filters) override;
147 
149  hashmap<SlaveID,
151  getInverseOfferStatuses() override;
152 
153  void recoverResources(
154  const FrameworkID& frameworkId,
155  const SlaveID& slaveId,
156  const Resources& resources,
157  const Option<Filters>& filters) override;
158 
159  void suppressOffers(
160  const FrameworkID& frameworkId,
161  const std::set<std::string>& roles) override;
162 
163  void reviveOffers(
164  const FrameworkID& frameworkId,
165  const std::set<std::string>& roles) override;
166 
167  void setQuota(
168  const std::string& role,
169  const Quota& quota) override;
170 
171  void removeQuota(
172  const std::string& role) override;
173 
174  void updateWeights(
175  const std::vector<WeightInfo>& weightInfos) override;
176 
177 private:
178  MesosAllocator();
179  MesosAllocator(const MesosAllocator&); // Not copyable.
180  MesosAllocator& operator=(const MesosAllocator&); // Not assignable.
181 
183 };
184 
185 
186 // The basic interface for all Process-based allocators.
187 class MesosAllocatorProcess : public process::Process<MesosAllocatorProcess>
188 {
189 public:
191 
193 
194  // Explicitly unhide 'initialize' to silence a compiler warning
195  // from clang, since we overload below.
197 
198  virtual void initialize(
199  const Duration& allocationInterval,
200  const lambda::function<
201  void(const FrameworkID&,
202  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
203  offerCallback,
204  const lambda::function<
205  void(const FrameworkID&,
207  inverseOfferCallback,
208  const Option<std::set<std::string>>&
209  fairnessExcludeResourceNames = None(),
210  bool filterGpuResources = true,
211  const Option<DomainInfo>& domain = None(),
212  const Option<std::vector<Resources>>&
213  minAllocatableResources = None()) = 0;
214 
215  virtual void recover(
216  const int expectedAgentCount,
217  const hashmap<std::string, Quota>& quotas) = 0;
218 
219  virtual void addFramework(
220  const FrameworkID& frameworkId,
221  const FrameworkInfo& frameworkInfo,
222  const hashmap<SlaveID, Resources>& used,
223  bool active,
224  const std::set<std::string>& suppressedRoles) = 0;
225 
226  virtual void removeFramework(
227  const FrameworkID& frameworkId) = 0;
228 
229  virtual void activateFramework(
230  const FrameworkID& frameworkId) = 0;
231 
232  virtual void deactivateFramework(
233  const FrameworkID& frameworkId) = 0;
234 
235  virtual void updateFramework(
236  const FrameworkID& frameworkId,
237  const FrameworkInfo& frameworkInfo,
238  const std::set<std::string>& suppressedRoles) = 0;
239 
240  virtual void addSlave(
241  const SlaveID& slaveId,
242  const SlaveInfo& slaveInfo,
243  const std::vector<SlaveInfo::Capability>& capabilities,
245  const Resources& total,
246  const hashmap<FrameworkID, Resources>& used) = 0;
247 
248  virtual void removeSlave(
249  const SlaveID& slaveId) = 0;
250 
251  virtual void updateSlave(
252  const SlaveID& slave,
253  const SlaveInfo& slaveInfo,
254  const Option<Resources>& total = None(),
255  const Option<std::vector<SlaveInfo::Capability>>&
256  capabilities = None()) = 0;
257 
258  virtual void addResourceProvider(
259  const SlaveID& slave,
260  const Resources& total,
261  const hashmap<FrameworkID, Resources>& used) = 0;
262 
263  virtual void activateSlave(
264  const SlaveID& slaveId) = 0;
265 
266  virtual void deactivateSlave(
267  const SlaveID& slaveId) = 0;
268 
269  virtual void updateWhitelist(
270  const Option<hashset<std::string>>& whitelist) = 0;
271 
272  virtual void requestResources(
273  const FrameworkID& frameworkId,
274  const std::vector<Request>& requests) = 0;
275 
276  virtual void updateAllocation(
277  const FrameworkID& frameworkId,
278  const SlaveID& slaveId,
279  const Resources& offeredResources,
280  const std::vector<ResourceConversion>& conversions) = 0;
281 
283  const SlaveID& slaveId,
284  const std::vector<Offer::Operation>& operations) = 0;
285 
286  virtual void updateUnavailability(
287  const SlaveID& slaveId,
288  const Option<Unavailability>& unavailability) = 0;
289 
290  virtual void updateInverseOffer(
291  const SlaveID& slaveId,
292  const FrameworkID& frameworkId,
293  const Option<UnavailableResources>& unavailableResources,
295  const Option<Filters>& filters = None()) = 0;
296 
297  virtual process::Future<
298  hashmap<SlaveID,
301 
302  virtual void recoverResources(
303  const FrameworkID& frameworkId,
304  const SlaveID& slaveId,
305  const Resources& resources,
306  const Option<Filters>& filters) = 0;
307 
308  virtual void suppressOffers(
309  const FrameworkID& frameworkId,
310  const std::set<std::string>& roles) = 0;
311 
312  virtual void reviveOffers(
313  const FrameworkID& frameworkId,
314  const std::set<std::string>& roles) = 0;
315 
316  virtual void setQuota(
317  const std::string& role,
318  const Quota& quota) = 0;
319 
320  virtual void removeQuota(
321  const std::string& role) = 0;
322 
323  virtual void updateWeights(
324  const std::vector<WeightInfo>& weightInfos) = 0;
325 };
326 
327 
328 template <typename AllocatorProcess>
331 {
332  mesos::allocator::Allocator* allocator =
334  return CHECK_NOTNULL(allocator);
335 }
336 
337 
338 template <typename AllocatorProcess>
340 {
341  process = new AllocatorProcess();
343 }
344 
345 
346 template <typename AllocatorProcess>
348 {
351  delete process;
352 }
353 
354 
355 template <typename AllocatorProcess>
357  const Duration& allocationInterval,
358  const lambda::function<
359  void(const FrameworkID&,
360  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
361  offerCallback,
362  const lambda::function<
363  void(const FrameworkID&,
365  inverseOfferCallback,
366  const Option<std::set<std::string>>& fairnessExcludeResourceNames,
367  bool filterGpuResources,
368  const Option<DomainInfo>& domain,
369  const Option<std::vector<Resources>>& minAllocatableResources)
370 {
372  process,
374  allocationInterval,
375  offerCallback,
376  inverseOfferCallback,
377  fairnessExcludeResourceNames,
378  filterGpuResources,
379  domain,
380  minAllocatableResources);
381 }
382 
383 
384 template <typename AllocatorProcess>
386  const int expectedAgentCount,
387  const hashmap<std::string, Quota>& quotas)
388 {
390  process,
392  expectedAgentCount,
393  quotas);
394 }
395 
396 
397 template <typename AllocatorProcess>
399  const FrameworkID& frameworkId,
400  const FrameworkInfo& frameworkInfo,
401  const hashmap<SlaveID, Resources>& used,
402  bool active,
403  const std::set<std::string>& suppressedRoles)
404 {
406  process,
408  frameworkId,
409  frameworkInfo,
410  used,
411  active,
412  suppressedRoles);
413 }
414 
415 
416 template <typename AllocatorProcess>
418  const FrameworkID& frameworkId)
419 {
421  process,
423  frameworkId);
424 }
425 
426 
427 template <typename AllocatorProcess>
429  const FrameworkID& frameworkId)
430 {
432  process,
434  frameworkId);
435 }
436 
437 
438 template <typename AllocatorProcess>
440  const FrameworkID& frameworkId)
441 {
443  process,
445  frameworkId);
446 }
447 
448 
449 template <typename AllocatorProcess>
451  const FrameworkID& frameworkId,
452  const FrameworkInfo& frameworkInfo,
453  const std::set<std::string>& suppressedRoles)
454 {
456  process,
458  frameworkId,
459  frameworkInfo,
460  suppressedRoles);
461 }
462 
463 
464 template <typename AllocatorProcess>
466  const SlaveID& slaveId,
467  const SlaveInfo& slaveInfo,
468  const std::vector<SlaveInfo::Capability>& capabilities,
470  const Resources& total,
472 {
474  process,
476  slaveId,
477  slaveInfo,
478  capabilities,
479  unavailability,
480  total,
481  used);
482 }
483 
484 
485 template <typename AllocatorProcess>
487  const SlaveID& slaveId)
488 {
490  process,
492  slaveId);
493 }
494 
495 
496 template <typename AllocatorProcess>
498  const SlaveID& slaveId,
499  const SlaveInfo& slaveInfo,
500  const Option<Resources>& total,
501  const Option<std::vector<SlaveInfo::Capability>>& capabilities)
502 {
504  process,
506  slaveId,
507  slaveInfo,
508  total,
509  capabilities);
510 }
511 
512 template <typename AllocatorProcess>
514  const SlaveID& slave,
515  const Resources& total,
517 {
519  process,
521  slave,
522  total,
523  used);
524 }
525 
526 
527 template <typename AllocatorProcess>
529  const SlaveID& slaveId)
530 {
532  process,
534  slaveId);
535 }
536 
537 
538 template <typename AllocatorProcess>
540  const SlaveID& slaveId)
541 {
543  process,
545  slaveId);
546 }
547 
548 
549 template <typename AllocatorProcess>
551  const Option<hashset<std::string>>& whitelist)
552 {
554  process,
556  whitelist);
557 }
558 
559 
560 template <typename AllocatorProcess>
562  const FrameworkID& frameworkId,
563  const std::vector<Request>& requests)
564 {
566  process,
568  frameworkId,
569  requests);
570 }
571 
572 
573 template <typename AllocatorProcess>
575  const FrameworkID& frameworkId,
576  const SlaveID& slaveId,
577  const Resources& offeredResources,
578  const std::vector<ResourceConversion>& conversions)
579 {
581  process,
583  frameworkId,
584  slaveId,
585  offeredResources,
586  conversions);
587 }
588 
589 
590 template <typename AllocatorProcess>
593  const SlaveID& slaveId,
594  const std::vector<Offer::Operation>& operations)
595 {
596  return process::dispatch(
597  process,
599  slaveId,
600  operations);
601 }
602 
603 
604 template <typename AllocatorProcess>
606  const SlaveID& slaveId,
608 {
609  return process::dispatch(
610  process,
612  slaveId,
613  unavailability);
614 }
615 
616 
617 template <typename AllocatorProcess>
619  const SlaveID& slaveId,
620  const FrameworkID& frameworkId,
621  const Option<UnavailableResources>& unavailableResources,
623  const Option<Filters>& filters)
624 {
625  return process::dispatch(
626  process,
628  slaveId,
629  frameworkId,
630  unavailableResources,
631  status,
632  filters);
633 }
634 
635 
636 template <typename AllocatorProcess>
637 inline process::Future<
638  hashmap<SlaveID,
641 {
642  return process::dispatch(
643  process,
645 }
646 
647 
648 template <typename AllocatorProcess>
650  const FrameworkID& frameworkId,
651  const SlaveID& slaveId,
652  const Resources& resources,
653  const Option<Filters>& filters)
654 {
656  process,
658  frameworkId,
659  slaveId,
660  resources,
661  filters);
662 }
663 
664 
665 template <typename AllocatorProcess>
667  const FrameworkID& frameworkId,
668  const std::set<std::string>& roles)
669 {
671  process,
673  frameworkId,
674  roles);
675 }
676 
677 
678 template <typename AllocatorProcess>
680  const FrameworkID& frameworkId,
681  const std::set<std::string>& roles)
682 {
684  process,
686  frameworkId,
687  roles);
688 }
689 
690 
691 template <typename AllocatorProcess>
693  const std::string& role,
694  const Quota& quota)
695 {
697  process,
699  role,
700  quota);
701 }
702 
703 
704 template <typename AllocatorProcess>
706  const std::string& role)
707 {
709  process,
711  role);
712 }
713 
714 
715 template <typename AllocatorProcess>
717  const std::vector<WeightInfo>& weightInfos)
718 {
720  process,
722  weightInfos);
723 }
724 
725 } // namespace allocator {
726 } // namespace master {
727 } // namespace internal {
728 } // namespace mesos {
729 
730 #endif // __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
virtual void deactivateSlave(const SlaveID &slaveId)=0
virtual void requestResources(const FrameworkID &frameworkId, const std::vector< Request > &requests)=0
void suppressOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles) override
Suppresses offers.
Definition: allocator.hpp:666
virtual void updateInverseOffer(const SlaveID &slaveId, const FrameworkID &frameworkId, const Option< UnavailableResources > &unavailableResources, const Option< mesos::allocator::InverseOfferStatus > &status, const Option< Filters > &filters=None())=0
Definition: option.hpp:28
void activateSlave(const SlaveID &slaveId) override
Activates an agent.
Definition: allocator.hpp:528
virtual void addResourceProvider(const SlaveID &slave, const Resources &total, const hashmap< FrameworkID, Resources > &used)=0
void updateWeights(const std::vector< WeightInfo > &weightInfos) override
Updates the weight associated with one or more roles.
Definition: allocator.hpp:716
Definition: master.hpp:27
void requestResources(const FrameworkID &frameworkId, const std::vector< Request > &requests) override
Requests resources for a framework.
Definition: allocator.hpp:561
virtual void recover(const int expectedAgentCount, const hashmap< std::string, Quota > &quotas)=0
Definition: check.hpp:33
void recover(const int expectedAgentCount, const hashmap< std::string, Quota > &quotas) override
Informs the allocator of the recovered state from the master.
Definition: allocator.hpp:385
virtual void deactivateFramework(const FrameworkID &frameworkId)=0
void deactivateSlave(const SlaveID &slaveId) override
Deactivates an agent.
Definition: allocator.hpp:539
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
virtual void setQuota(const std::string &role, const Quota &quota)=0
Definition: resources.hpp:79
virtual void addSlave(const SlaveID &slaveId, const SlaveInfo &slaveInfo, const std::vector< SlaveInfo::Capability > &capabilities, const Option< Unavailability > &unavailability, const Resources &total, const hashmap< FrameworkID, Resources > &used)=0
virtual void activateFramework(const FrameworkID &frameworkId)=0
void removeFramework(const FrameworkID &frameworkId) override
Removes a framework from the Mesos cluster.
Definition: allocator.hpp:417
static Try< mesos::allocator::Allocator * > create()
Definition: allocator.hpp:330
UPID spawn(ProcessBase *process, bool manage=false)
Spawn a new process.
Definition: duration.hpp:32
void terminate(const UPID &pid, bool inject=true)
Sends a TerminateEvent to the given process.
void removeSlave(const SlaveID &slaveId) override
Removes an agent from the Mesos cluster.
Definition: allocator.hpp:486
void reviveOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles) override
Revives offers to this framework for the specified roles.
Definition: allocator.hpp:679
Definition: hashmap.hpp:38
~MesosAllocatorProcess() override
Definition: allocator.hpp:192
void dispatch(const PID< T > &pid, void(T::*method)())
Definition: dispatch.hpp:174
void initialize(const Duration &allocationInterval, const lambda::function< void(const FrameworkID &, const hashmap< std::string, hashmap< SlaveID, Resources >> &)> &offerCallback, const lambda::function< void(const FrameworkID &, const hashmap< SlaveID, UnavailableResources > &)> &inverseOfferCallback, const Option< std::set< std::string >> &fairnessExcludeResourceNames=None(), bool filterGpuResources=true, const Option< DomainInfo > &domain=None(), const Option< std::vector< Resources >> &minAllocatableResources=None()) override
Initializes the allocator when the master starts up.
Definition: allocator.hpp:356
virtual void suppressOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles)=0
virtual process::Future< hashmap< SlaveID, hashmap< FrameworkID, mesos::allocator::InverseOfferStatus > > > getInverseOfferStatuses()=0
Definition: quota.hpp:25
Try< Nothing > unavailability(const Unavailability &unavailability)
void updateWhitelist(const Option< hashset< std::string >> &whitelist) override
Updates the list of trusted agents.
Definition: allocator.hpp:550
Result< std::vector< Filter< Classifier > > > filters(const std::string &_link, const Handle &parent)
Definition: internal.hpp:776
virtual void activateSlave(const SlaveID &slaveId)=0
virtual void removeSlave(const SlaveID &slaveId)=0
virtual void initialize()
Invoked when a process gets spawned.
Definition: process.hpp:100
void setQuota(const std::string &role, const Quota &quota) override
Informs the allocator to set quota for the given role.
Definition: allocator.hpp:692
Definition: spec.hpp:30
void addFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo, const hashmap< SlaveID, Resources > &used, bool active, const std::set< std::string > &suppressedRoles) override
Adds a framework to the Mesos cluster.
Definition: allocator.hpp:398
void recoverResources(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &resources, const Option< Filters > &filters) override
Recovers resources.
Definition: allocator.hpp:649
virtual void updateUnavailability(const SlaveID &slaveId, const Option< Unavailability > &unavailability)=0
~MesosAllocator() override
Definition: allocator.hpp:347
virtual process::Future< Nothing > updateAvailable(const SlaveID &slaveId, const std::vector< Offer::Operation > &operations)=0
void deactivateFramework(const FrameworkID &frameworkId) override
Deactivates a framework in the Mesos cluster.
Definition: allocator.hpp:439
virtual void reviveOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles)=0
void updateAllocation(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &offeredResources, const std::vector< ResourceConversion > &conversions) override
Updates allocation by applying offer operations.
Definition: allocator.hpp:574
virtual void updateWeights(const std::vector< WeightInfo > &weightInfos)=0
virtual void updateFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo, const std::set< std::string > &suppressedRoles)=0
bool wait(const UPID &pid, const Duration &duration=Seconds(-1))
Wait for the process to exit for no more than the specified seconds.
void updateSlave(const SlaveID &slave, const SlaveInfo &slaveInfo, const Option< Resources > &total=None(), const Option< std::vector< SlaveInfo::Capability >> &capabilities=None()) override
Updates an agent.
Definition: allocator.hpp:497
void updateInverseOffer(const SlaveID &slaveId, const FrameworkID &frameworkId, const Option< UnavailableResources > &unavailableResources, const Option< mesos::allocator::InverseOfferStatus > &status, const Option< Filters > &filters) override
Definition: allocator.hpp:618
virtual void updateWhitelist(const Option< hashset< std::string >> &whitelist)=0
Basic model of an allocator: resources are allocated to a framework in the form of offers...
Definition: allocator.hpp:55
void activateFramework(const FrameworkID &frameworkId) override
Activates a framework in the Mesos cluster.
Definition: allocator.hpp:428
Definition: none.hpp:27
Definition: attributes.hpp:24
virtual void removeFramework(const FrameworkID &frameworkId)=0
process::Future< hashmap< SlaveID, hashmap< FrameworkID, mesos::allocator::InverseOfferStatus > > > getInverseOfferStatuses() override
Retrieves the status of all inverse offers maintained by the allocator.
Definition: allocator.hpp:640
void updateUnavailability(const SlaveID &slaveId, const Option< Unavailability > &unavailability) override
Updates unavailability for an agent.
Definition: allocator.hpp:605
void addSlave(const SlaveID &slaveId, const SlaveInfo &slaveInfo, const std::vector< SlaveInfo::Capability > &capabilities, const Option< Unavailability > &unavailability, const Resources &total, const hashmap< FrameworkID, Resources > &used) override
Adds or re-adds an agent to the Mesos cluster.
Definition: allocator.hpp:465
virtual void updateSlave(const SlaveID &slave, const SlaveInfo &slaveInfo, const Option< Resources > &total=None(), const Option< std::vector< SlaveInfo::Capability >> &capabilities=None())=0
Definition: executor.hpp:48
void updateFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo, const std::set< std::string > &suppressedRoles) override
Updates capabilities of a framework in the Mesos cluster.
Definition: allocator.hpp:450
virtual void removeQuota(const std::string &role)=0
process::Future< Nothing > updateAvailable(const SlaveID &slaveId, const std::vector< Offer::Operation > &operations) override
Updates available resources on an agent based on a sequence of offer operations.
Definition: allocator.hpp:592
void addResourceProvider(const SlaveID &slave, const Resources &total, const hashmap< FrameworkID, Resources > &used) override
Add resources from a local resource provider to an agent.
Definition: allocator.hpp:513
virtual void recoverResources(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &resources, const Option< Filters > &filters)=0
virtual void addFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo, const hashmap< SlaveID, Resources > &used, bool active, const std::set< std::string > &suppressedRoles)=0
void removeQuota(const std::string &role) override
Informs the allocator to remove quota for the given role.
Definition: allocator.hpp:705
virtual void updateAllocation(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &offeredResources, const std::vector< ResourceConversion > &conversions)=0
Definition: process.hpp:501