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  const size_t maxCompletedFrameworks = 0) 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,
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  void pause() override;
178 
179  void resume() override;
180 
181 private:
182  MesosAllocator();
183  MesosAllocator(const MesosAllocator&); // Not copyable.
184  MesosAllocator& operator=(const MesosAllocator&); // Not assignable.
185 
187 };
188 
189 
190 // The basic interface for all Process-based allocators.
191 class MesosAllocatorProcess : public process::Process<MesosAllocatorProcess>
192 {
193 public:
195 
197 
198  // Explicitly unhide 'initialize' to silence a compiler warning
199  // from clang, since we overload below.
201 
202  virtual void initialize(
203  const Duration& allocationInterval,
204  const lambda::function<
205  void(const FrameworkID&,
206  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
207  offerCallback,
208  const lambda::function<
209  void(const FrameworkID&,
211  inverseOfferCallback,
212  const Option<std::set<std::string>>&
213  fairnessExcludeResourceNames = None(),
214  bool filterGpuResources = true,
215  const Option<DomainInfo>& domain = None(),
216  const Option<std::vector<Resources>>&
217  minAllocatableResources = None(),
218  const size_t maxCompletedFrameworks = 0) = 0;
219 
220  virtual void recover(
221  const int expectedAgentCount,
222  const hashmap<std::string, Quota>& quotas) = 0;
223 
224  virtual void addFramework(
225  const FrameworkID& frameworkId,
226  const FrameworkInfo& frameworkInfo,
228  bool active,
229  const std::set<std::string>& suppressedRoles) = 0;
230 
231  virtual void removeFramework(
232  const FrameworkID& frameworkId) = 0;
233 
234  virtual void activateFramework(
235  const FrameworkID& frameworkId) = 0;
236 
237  virtual void deactivateFramework(
238  const FrameworkID& frameworkId) = 0;
239 
240  virtual void updateFramework(
241  const FrameworkID& frameworkId,
242  const FrameworkInfo& frameworkInfo,
243  const std::set<std::string>& suppressedRoles) = 0;
244 
245  virtual void addSlave(
246  const SlaveID& slaveId,
247  const SlaveInfo& slaveInfo,
248  const std::vector<SlaveInfo::Capability>& capabilities,
250  const Resources& total,
251  const hashmap<FrameworkID, Resources>& used) = 0;
252 
253  virtual void removeSlave(
254  const SlaveID& slaveId) = 0;
255 
256  virtual void updateSlave(
257  const SlaveID& slave,
258  const SlaveInfo& slaveInfo,
259  const Option<Resources>& total = None(),
260  const Option<std::vector<SlaveInfo::Capability>>&
261  capabilities = None()) = 0;
262 
263  virtual void addResourceProvider(
264  const SlaveID& slave,
265  const Resources& total,
266  const hashmap<FrameworkID, Resources>& used) = 0;
267 
268  virtual void activateSlave(
269  const SlaveID& slaveId) = 0;
270 
271  virtual void deactivateSlave(
272  const SlaveID& slaveId) = 0;
273 
274  virtual void updateWhitelist(
275  const Option<hashset<std::string>>& whitelist) = 0;
276 
277  virtual void requestResources(
278  const FrameworkID& frameworkId,
279  const std::vector<Request>& requests) = 0;
280 
281  virtual void updateAllocation(
282  const FrameworkID& frameworkId,
283  const SlaveID& slaveId,
284  const Resources& offeredResources,
285  const std::vector<ResourceConversion>& conversions) = 0;
286 
288  const SlaveID& slaveId,
289  const std::vector<Offer::Operation>& operations) = 0;
290 
291  virtual void updateUnavailability(
292  const SlaveID& slaveId,
293  const Option<Unavailability>& unavailability) = 0;
294 
295  virtual void updateInverseOffer(
296  const SlaveID& slaveId,
297  const FrameworkID& frameworkId,
298  const Option<UnavailableResources>& unavailableResources,
300  const Option<Filters>& filters = None()) = 0;
301 
302  virtual process::Future<
303  hashmap<SlaveID,
306 
307  virtual void recoverResources(
308  const FrameworkID& frameworkId,
309  const SlaveID& slaveId,
310  const Resources& resources,
311  const Option<Filters>& filters) = 0;
312 
313  virtual void suppressOffers(
314  const FrameworkID& frameworkId,
315  const std::set<std::string>& roles) = 0;
316 
317  virtual void reviveOffers(
318  const FrameworkID& frameworkId,
319  const std::set<std::string>& roles) = 0;
320 
321  virtual void setQuota(
322  const std::string& role,
323  const Quota& quota) = 0;
324 
325  virtual void removeQuota(
326  const std::string& role) = 0;
327 
328  virtual void updateWeights(
329  const std::vector<WeightInfo>& weightInfos) = 0;
330 
331  virtual void pause() = 0;
332 
333  virtual void resume() = 0;
334 };
335 
336 
337 template <typename AllocatorProcess>
340 {
341  mesos::allocator::Allocator* allocator =
343  return CHECK_NOTNULL(allocator);
344 }
345 
346 
347 template <typename AllocatorProcess>
349 {
350  process = new AllocatorProcess();
352 }
353 
354 
355 template <typename AllocatorProcess>
357 {
360  delete process;
361 }
362 
363 
364 template <typename AllocatorProcess>
366  const Duration& allocationInterval,
367  const lambda::function<
368  void(const FrameworkID&,
369  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
370  offerCallback,
371  const lambda::function<
372  void(const FrameworkID&,
374  inverseOfferCallback,
375  const Option<std::set<std::string>>& fairnessExcludeResourceNames,
376  bool filterGpuResources,
377  const Option<DomainInfo>& domain,
378  const Option<std::vector<Resources>>& minAllocatableResources,
379  const size_t maxCompletedFrameworks)
380 {
382  process,
384  allocationInterval,
385  offerCallback,
386  inverseOfferCallback,
387  fairnessExcludeResourceNames,
388  filterGpuResources,
389  domain,
390  minAllocatableResources,
391  maxCompletedFrameworks);
392 }
393 
394 
395 template <typename AllocatorProcess>
397  const int expectedAgentCount,
398  const hashmap<std::string, Quota>& quotas)
399 {
401  process,
403  expectedAgentCount,
404  quotas);
405 }
406 
407 
408 template <typename AllocatorProcess>
410  const FrameworkID& frameworkId,
411  const FrameworkInfo& frameworkInfo,
413  bool active,
414  const std::set<std::string>& suppressedRoles)
415 {
417  process,
419  frameworkId,
420  frameworkInfo,
421  used,
422  active,
423  suppressedRoles);
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 {
454  process,
456  frameworkId);
457 }
458 
459 
460 template <typename AllocatorProcess>
462  const FrameworkID& frameworkId,
463  const FrameworkInfo& frameworkInfo,
464  const std::set<std::string>& suppressedRoles)
465 {
467  process,
469  frameworkId,
470  frameworkInfo,
471  suppressedRoles);
472 }
473 
474 
475 template <typename AllocatorProcess>
477  const SlaveID& slaveId,
478  const SlaveInfo& slaveInfo,
479  const std::vector<SlaveInfo::Capability>& capabilities,
481  const Resources& total,
483 {
485  process,
487  slaveId,
488  slaveInfo,
489  capabilities,
490  unavailability,
491  total,
492  used);
493 }
494 
495 
496 template <typename AllocatorProcess>
498  const SlaveID& slaveId)
499 {
501  process,
503  slaveId);
504 }
505 
506 
507 template <typename AllocatorProcess>
509  const SlaveID& slaveId,
510  const SlaveInfo& slaveInfo,
511  const Option<Resources>& total,
512  const Option<std::vector<SlaveInfo::Capability>>& capabilities)
513 {
515  process,
517  slaveId,
518  slaveInfo,
519  total,
520  capabilities);
521 }
522 
523 template <typename AllocatorProcess>
525  const SlaveID& slave,
526  const Resources& total,
528 {
530  process,
532  slave,
533  total,
534  used);
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 SlaveID& slaveId)
552 {
554  process,
556  slaveId);
557 }
558 
559 
560 template <typename AllocatorProcess>
562  const Option<hashset<std::string>>& whitelist)
563 {
565  process,
567  whitelist);
568 }
569 
570 
571 template <typename AllocatorProcess>
573  const FrameworkID& frameworkId,
574  const std::vector<Request>& requests)
575 {
577  process,
579  frameworkId,
580  requests);
581 }
582 
583 
584 template <typename AllocatorProcess>
586  const FrameworkID& frameworkId,
587  const SlaveID& slaveId,
588  const Resources& offeredResources,
589  const std::vector<ResourceConversion>& conversions)
590 {
592  process,
594  frameworkId,
595  slaveId,
596  offeredResources,
597  conversions);
598 }
599 
600 
601 template <typename AllocatorProcess>
604  const SlaveID& slaveId,
605  const std::vector<Offer::Operation>& operations)
606 {
607  return process::dispatch(
608  process,
610  slaveId,
611  operations);
612 }
613 
614 
615 template <typename AllocatorProcess>
617  const SlaveID& slaveId,
619 {
620  return process::dispatch(
621  process,
623  slaveId,
624  unavailability);
625 }
626 
627 
628 template <typename AllocatorProcess>
630  const SlaveID& slaveId,
631  const FrameworkID& frameworkId,
632  const Option<UnavailableResources>& unavailableResources,
634  const Option<Filters>& filters)
635 {
636  return process::dispatch(
637  process,
639  slaveId,
640  frameworkId,
641  unavailableResources,
642  status,
643  filters);
644 }
645 
646 
647 template <typename AllocatorProcess>
648 inline process::Future<
649  hashmap<SlaveID,
652 {
653  return process::dispatch(
654  process,
656 }
657 
658 
659 template <typename AllocatorProcess>
661  const FrameworkID& frameworkId,
662  const SlaveID& slaveId,
663  const Resources& resources,
664  const Option<Filters>& filters)
665 {
667  process,
669  frameworkId,
670  slaveId,
671  resources,
672  filters);
673 }
674 
675 
676 template <typename AllocatorProcess>
678  const FrameworkID& frameworkId,
679  const std::set<std::string>& roles)
680 {
682  process,
684  frameworkId,
685  roles);
686 }
687 
688 
689 template <typename AllocatorProcess>
691  const FrameworkID& frameworkId,
692  const std::set<std::string>& roles)
693 {
695  process,
697  frameworkId,
698  roles);
699 }
700 
701 
702 template <typename AllocatorProcess>
704  const std::string& role,
705  const Quota& quota)
706 {
708  process,
710  role,
711  quota);
712 }
713 
714 
715 template <typename AllocatorProcess>
717  const std::string& role)
718 {
720  process,
722  role);
723 }
724 
725 
726 template <typename AllocatorProcess>
728  const std::vector<WeightInfo>& weightInfos)
729 {
731  process,
733  weightInfos);
734 }
735 
736 
737 template <typename AllocatorProcess>
739 {
741 }
742 
743 
744 template <typename AllocatorProcess>
746 {
748 }
749 
750 
751 } // namespace allocator {
752 } // namespace master {
753 } // namespace internal {
754 } // namespace mesos {
755 
756 #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:677
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:539
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:727
Definition: master.hpp:27
void requestResources(const FrameworkID &frameworkId, const std::vector< Request > &requests) override
Requests resources for a framework.
Definition: allocator.hpp:572
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:396
virtual void deactivateFramework(const FrameworkID &frameworkId)=0
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(), const size_t maxCompletedFrameworks=0) override
Initializes the allocator when the master starts up.
Definition: allocator.hpp:365
void deactivateSlave(const SlaveID &slaveId) override
Deactivates an agent.
Definition: allocator.hpp:550
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
virtual void setQuota(const std::string &role, const Quota &quota)=0
Definition: resources.hpp:81
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:428
static Try< mesos::allocator::Allocator * > create()
Definition: allocator.hpp:339
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:497
void reviveOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles) override
Revives offers to this framework for the specified roles.
Definition: allocator.hpp:690
Definition: hashmap.hpp:38
~MesosAllocatorProcess() override
Definition: allocator.hpp:196
void dispatch(const PID< T > &pid, void(T::*method)())
Definition: dispatch.hpp:174
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:561
Try< Bytes > used(const std::string &path="/")
Definition: fs.hpp:43
Result< std::vector< Filter< Classifier > > > filters(const std::string &_link, const Handle &parent)
Definition: internal.hpp:769
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:703
Definition: spec.hpp:26
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:409
void recoverResources(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &resources, const Option< Filters > &filters) override
Recovers resources.
Definition: allocator.hpp:660
virtual void updateUnavailability(const SlaveID &slaveId, const Option< Unavailability > &unavailability)=0
~MesosAllocator() override
Definition: allocator.hpp:356
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:450
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:585
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:508
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:629
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:439
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:651
void updateUnavailability(const SlaveID &slaveId, const Option< Unavailability > &unavailability) override
Updates unavailability for an agent.
Definition: allocator.hpp:616
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:476
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:461
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:603
void resume() override
Idempotent helper to resume allocations.
Definition: allocator.hpp:745
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:524
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:716
virtual void updateAllocation(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &offeredResources, const std::vector< ResourceConversion > &conversions)=0
Definition: process.hpp:501
void pause() override
Idempotent helper to pause allocations.
Definition: allocator.hpp:738