Apache Mesos
hierarchical.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_HIERARCHICAL_HPP__
18 #define __MASTER_ALLOCATOR_MESOS_HIERARCHICAL_HPP__
19 
20 #include <set>
21 #include <string>
22 
23 #include <mesos/mesos.hpp>
24 
25 #include <process/future.hpp>
26 #include <process/id.hpp>
27 #include <process/owned.hpp>
28 
29 #include <stout/boundedhashmap.hpp>
30 #include <stout/duration.hpp>
31 #include <stout/hashmap.hpp>
32 #include <stout/hashset.hpp>
33 #include <stout/lambda.hpp>
34 #include <stout/option.hpp>
35 
37 
40 
43 
44 #include "master/constants.hpp"
45 
46 namespace mesos {
47 namespace internal {
48 namespace master {
49 namespace allocator {
50 
51 // We forward declare the hierarchical allocator process so that we
52 // can typedef an instantiation of it with DRF sorters.
53 template <
54  typename RoleSorter,
55  typename FrameworkSorter,
56  typename QuotaRoleSorter>
58 
61 
64 
67 
70 
71 
72 namespace internal {
73 
74 // Forward declarations.
75 class OfferFilter;
76 class InverseOfferFilter;
77 
78 
79 struct Framework
80 {
81  Framework(
82  const FrameworkInfo& frameworkInfo,
83  const std::set<std::string>& suppressedRoles,
84  bool active,
86 
87  std::set<std::string> roles;
88 
89  std::set<std::string> suppressedRoles;
90 
92 
93  // Active offer and inverse offer filters for the framework.
94  // Offer filters are tied to the role the filtered resources
95  // were allocated to.
98 
99  bool active;
100 
102 
104 };
105 
106 
107 class Slave
108 {
109 public:
111  const SlaveInfo& _info,
112  const protobuf::slave::Capabilities& _capabilities,
113  bool _activated,
114  const Resources& _total,
115  const Resources& _allocated)
116  : info(_info),
117  capabilities(_capabilities),
118  activated(_activated),
119  total(_total),
120  allocated(_allocated),
121  shared(_total.shared()),
122  hasGpu_(_total.gpus().getOrElse(0) > 0)
123  {
124  updateAvailable();
125  }
126 
127  const Resources& getTotal() const { return total; }
128 
129  const Resources& getAllocated() const { return allocated; }
130 
131  const Resources& getAvailable() const { return available; }
132 
133  bool hasGpu() const { return hasGpu_; }
134 
135  void updateTotal(const Resources& newTotal) {
136  total = newTotal;
137  shared = total.shared();
138  hasGpu_ = total.gpus().getOrElse(0) > 0;
139 
140  updateAvailable();
141  }
142 
143  void allocate(const Resources& toAllocate)
144  {
145  allocated += toAllocate;
146 
147  updateAvailable();
148  }
149 
150  void unallocate(const Resources& toUnallocate)
151  {
152  allocated -= toUnallocate;
153 
154  updateAvailable();
155  }
156 
157  // The `SlaveInfo` that was passed to the allocator when the slave was added
158  // or updated. Currently only two fields are used: `hostname` for host
159  // whitelisting and in log messages, and `domain` for region-aware
160  // scheduling.
161  SlaveInfo info;
162 
164 
165  bool activated; // Whether to offer resources.
166 
167  // Represents a scheduled unavailability due to maintenance for a specific
168  // slave, and the responses from frameworks as to whether they will be able
169  // to gracefully handle this unavailability.
170  //
171  // NOTE: We currently implement maintenance in the allocator to be able to
172  // leverage state and features such as the FrameworkSorter and OfferFilter.
173  struct Maintenance
174  {
175  Maintenance(const Unavailability& _unavailability)
176  : unavailability(_unavailability) {}
177 
178  // The start time and optional duration of the event.
179  Unavailability unavailability;
180 
181  // A mapping of frameworks to the inverse offer status associated with
182  // this unavailability.
183  //
184  // NOTE: We currently lose this information during a master fail over
185  // since it is not persisted or replicated. This is ok as the new master's
186  // allocator will send out new inverse offers and re-collect the
187  // information. This is similar to all the outstanding offers from an old
188  // master being invalidated, and new offers being sent out.
190 
191  // Represents the "unit of accounting" for maintenance. When a
192  // `FrameworkID` is present in the hashset it means an inverse offer has
193  // been sent out. When it is not present it means no offer is currently
194  // outstanding.
196  };
197 
198  // When the `maintenance` is set the slave is scheduled to be unavailable at
199  // a given point in time, for an optional duration. This information is used
200  // to send out `InverseOffers`.
202 
203 private:
204  void updateAvailable() {
205  // In order to subtract from the total,
206  // we strip the allocation information.
207  Resources allocated_ = allocated;
208  allocated_.unallocate();
209 
210  // Calling `nonShared()` currently copies the underlying resources
211  // and is therefore rather expensive. We avoid it in the common
212  // case that there are no shared resources.
213  //
214  // TODO(mzhu): Ideally there would be a single logical path here.
215  // One solution is to have `Resources` be copy-on-write such that
216  // `nonShared()` performs no copying and instead points to a
217  // subset of the original `Resource` objects.
218  if (shared.empty()) {
219  available = total - allocated_;
220  } else {
221  // Since shared resources are offerable even when they are in use, we
222  // always include them as part of available resources.
223  available = (total.nonShared() - allocated_.nonShared()) + shared;
224  }
225  }
226 
227  // Total amount of regular *and* oversubscribed resources.
228  Resources total;
229 
230  // Regular *and* oversubscribed resources that are allocated.
231  //
232  // NOTE: We maintain multiple copies of each shared resource allocated
233  // to a slave, where the number of copies represents the number of times
234  // this shared resource has been allocated to (and has not been recovered
235  // from) a specific framework.
236  //
237  // NOTE: We keep track of the slave's allocated resources despite
238  // having that information in sorters. This is because the
239  // information in sorters is not accurate if some framework
240  // hasn't reregistered. See MESOS-2919 for details.
241  Resources allocated;
242 
243  // We track the total and allocated resources on the slave to
244  // avoid calculating it in place every time.
245  //
246  // Note that `available` always contains all the shared resources on the
247  // agent regardless whether they have ever been allocated or not.
248  // NOTE, however, we currently only offer a shared resource only if it has
249  // not been offered in an allocation cycle to a framework. We do this mainly
250  // to preserve the normal offer behavior. This may change in the future
251  // depending on use cases.
252  //
253  // Note that it's possible for the slave to be over-allocated!
254  // In this case, allocated > total.
255  Resources available;
256 
257  // We keep a copy of the shared resources to avoid unnecessary copying.
258  Resources shared;
259 
260  // We cache whether the agent has gpus as an optimization.
261  bool hasGpu_;
262 };
263 
264 
265 // Implements the basic allocator algorithm - first pick a role by
266 // some criteria, then pick one of their frameworks to allocate to.
268 {
269 public:
271  const std::function<Sorter*()>& roleSorterFactory,
272  const std::function<Sorter*()>& _frameworkSorterFactory,
273  const std::function<Sorter*()>& quotaRoleSorterFactory)
274  : initialized(false),
275  paused(true),
276  metrics(*this),
277  completedFrameworkMetrics(0),
278  roleSorter(roleSorterFactory()),
279  quotaRoleSorter(quotaRoleSorterFactory()),
280  frameworkSorterFactory(_frameworkSorterFactory) {}
281 
283 
285  {
286  return process::PID<Self>(this);
287  }
288 
289  void initialize(
290  const mesos::allocator::Options& options,
291  const lambda::function<
292  void(const FrameworkID&,
293  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
294  offerCallback,
295  const lambda::function<
296  void(const FrameworkID&,
298  inverseOfferCallback) override;
299 
300  void recover(
301  const int _expectedAgentCount,
302  const hashmap<std::string, Quota>& quotas) override;
303 
304  void addFramework(
305  const FrameworkID& frameworkId,
306  const FrameworkInfo& frameworkInfo,
308  bool active,
309  const std::set<std::string>& suppressedRoles) override;
310 
311  void removeFramework(
312  const FrameworkID& frameworkId) override;
313 
314  void activateFramework(
315  const FrameworkID& frameworkId) override;
316 
317  void deactivateFramework(
318  const FrameworkID& frameworkId) override;
319 
320  void updateFramework(
321  const FrameworkID& frameworkId,
322  const FrameworkInfo& frameworkInfo,
323  const std::set<std::string>& suppressedRoles) override;
324 
325  void addSlave(
326  const SlaveID& slaveId,
327  const SlaveInfo& slaveInfo,
328  const std::vector<SlaveInfo::Capability>& capabilities,
330  const Resources& total,
331  const hashmap<FrameworkID, Resources>& used) override;
332 
333  void removeSlave(
334  const SlaveID& slaveId) override;
335 
336  void updateSlave(
337  const SlaveID& slave,
338  const SlaveInfo& slaveInfo,
339  const Option<Resources>& total = None(),
340  const Option<std::vector<SlaveInfo::Capability>>& capabilities = None())
341  override;
342 
343  void addResourceProvider(
344  const SlaveID& slave,
345  const Resources& total,
346  const hashmap<FrameworkID, Resources>& used) override;
347 
348  void deactivateSlave(
349  const SlaveID& slaveId) override;
350 
351  void activateSlave(
352  const SlaveID& slaveId) override;
353 
354  void updateWhitelist(
355  const Option<hashset<std::string>>& whitelist) override;
356 
357  void requestResources(
358  const FrameworkID& frameworkId,
359  const std::vector<Request>& requests) override;
360 
361  void updateAllocation(
362  const FrameworkID& frameworkId,
363  const SlaveID& slaveId,
364  const Resources& offeredResources,
365  const std::vector<ResourceConversion>& conversions) override;
366 
367  process::Future<Nothing> updateAvailable(
368  const SlaveID& slaveId,
369  const std::vector<Offer::Operation>& operations) override;
370 
371  void updateUnavailability(
372  const SlaveID& slaveId,
373  const Option<Unavailability>& unavailability) override;
374 
375  void updateInverseOffer(
376  const SlaveID& slaveId,
377  const FrameworkID& frameworkId,
378  const Option<UnavailableResources>& unavailableResources,
380  const Option<Filters>& filters) override;
381 
383  hashmap<SlaveID,
385  getInverseOfferStatuses() override;
386 
387  void recoverResources(
388  const FrameworkID& frameworkId,
389  const SlaveID& slaveId,
390  const Resources& resources,
391  const Option<Filters>& filters) override;
392 
393  void suppressOffers(
394  const FrameworkID& frameworkId,
395  const std::set<std::string>& roles) override;
396 
397  void reviveOffers(
398  const FrameworkID& frameworkId,
399  const std::set<std::string>& roles) override;
400 
401  void setQuota(
402  const std::string& role,
403  const Quota& quota) override;
404 
405  void removeQuota(
406  const std::string& role) override;
407 
408  void updateWeights(
409  const std::vector<WeightInfo>& weightInfos) override;
410 
411  void pause() override;
412 
413  void resume() override;
414 
415 protected:
416  // Useful typedefs for dispatch/delay/defer to self()/this.
419 
420  // Allocate any allocatable resources from all known agents.
421  process::Future<Nothing> allocate();
422 
423  // Allocate resources from the specified agent.
424  process::Future<Nothing> allocate(const SlaveID& slaveId);
425 
426  // Allocate resources from the specified agents. The allocation
427  // is deferred and batched with other allocation requests.
428  process::Future<Nothing> allocate(const hashset<SlaveID>& slaveIds);
429 
430  // Method that performs allocation work.
431  Nothing _allocate();
432 
433  // Helper for `_allocate()` that allocates resources for offers.
434  void __allocate();
435 
436  // Helper for `_allocate()` that deallocates resources for inverse offers.
437  void deallocate();
438 
439  // Remove an offer filter for the specified role of the framework.
440  void expire(
441  const FrameworkID& frameworkId,
442  const std::string& role,
443  const SlaveID& slaveId,
444  OfferFilter* offerFilter);
445 
446  void _expire(
447  const FrameworkID& frameworkId,
448  const std::string& role,
449  const SlaveID& slaveId,
450  OfferFilter* offerFilter);
451 
452  // Remove an inverse offer filter for the specified framework.
453  void expire(
454  const FrameworkID& frameworkId,
455  const SlaveID& slaveId,
456  InverseOfferFilter* inverseOfferFilter);
457 
458  // Checks whether the slave is whitelisted.
459  bool isWhitelisted(const SlaveID& slaveId) const;
460 
461  // Returns true if there is a resource offer filter for the
462  // specified role of this framework on this slave.
463  bool isFiltered(
464  const FrameworkID& frameworkId,
465  const std::string& role,
466  const SlaveID& slaveId,
467  const Resources& resources) const;
468 
469  // Returns true if there is an inverse offer filter for this framework
470  // on this slave.
471  bool isFiltered(
472  const FrameworkID& frameworkID,
473  const SlaveID& slaveID) const;
474 
475  bool allocatable(const Resources& resources);
476 
478  bool paused;
479 
481 
482  // Recovery data.
484 
485  lambda::function<
486  void(const FrameworkID&,
487  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>
489 
490  lambda::function<
491  void(const FrameworkID&,
494 
495  friend Metrics;
497 
499  {
500  return static_cast<double>(eventCount<process::DispatchEvent>());
501  }
502 
503  double _resources_total(
504  const std::string& resource);
505 
506  double _resources_offered_or_allocated(
507  const std::string& resource);
508 
509  double _quota_allocated(
510  const std::string& role,
511  const std::string& resource);
512 
513  double _offer_filters_active(
514  const std::string& role);
515 
517 
520 
522 
523  // A set of agents that are kept as allocation candidates. Events
524  // may add or remove candidates to the set. When an allocation is
525  // processed, the set of candidates is cleared.
527 
528  // Future for the dispatched allocation that becomes
529  // ready after the allocation run is complete.
531 
532  // We track information about roles that we're aware of in the system.
533  // Specifically, we keep track of the roles when a framework subscribes to
534  // the role, and/or when there are resources allocated to the role
535  // (e.g. some tasks and/or executors are consuming resources under the role).
537 
538  // Configured quota for each role, if any. If a role does not have
539  // an entry here it has the default quota of (no guarantee, no limit).
541 
542  // Aggregated resource reservations on all agents tied to a
543  // particular role, if any. These are stripped scalar quantities
544  // that contain no meta-data.
545  //
546  // Only roles with non-empty reservations will be stored in the map.
548 
549  // Slaves to send offers for.
551 
552  // Resources (by name) that will be excluded from a role's fair share.
554 
555  // Filter GPU resources based on the `GPU_RESOURCES` framework capability.
557 
558  // The master's domain, if any.
560 
561  // The minimum allocatable resources, if any.
563 
564  // There are two stages of allocation:
565  //
566  // Stage 1: Allocate to satisfy quota guarantees.
567  //
568  // Stage 2: Allocate above quota guarantees up to quota limits.
569  // Note that we need to hold back enough "headroom"
570  // to ensure that any unsatisfied quota can be
571  // satisfied later.
572  //
573  // Each stage comprises two levels of sorting, hence "hierarchical".
574  // Level 1 sorts across roles:
575  // Currently, only the allocated portion of the reserved resources are
576  // accounted for fairness calculation.
577  //
578  // TODO(mpark): Reserved resources should be accounted for fairness
579  // calculation whether they are allocated or not, since they model a long or
580  // forever running task. That is, the effect of reserving resources is
581  // equivalent to launching a task in that the resources that make up the
582  // reservation are not available to other roles as non-revocable.
583  //
584  // Level 2 sorts across frameworks within a particular role:
585  // Reserved resources at this level are, and should be accounted for
586  // fairness calculation only if they are allocated. This is because
587  // reserved resources are fairly shared across the frameworks in the role.
588  //
589  // The allocator relies on `Sorter`s to employ a particular sorting
590  // algorithm. Each level has its own sorter and hence may have different
591  // fairness calculations.
592  //
593  // NOTE: The hierarchical allocator considers revocable resources as
594  // regular resources when doing fairness calculations.
595  //
596  // TODO(vinod): Consider using a different fairness algorithm for
597  // revocable resources.
598 
599  // A sorter for active roles. This sorter determines the order in which
600  // roles are allocated resources during Level 1 of the second stage.
601  // The total cluster resources are used as the resource pool.
603 
604  // TODO(bmahler): Remove this in favor of either using the same sorting
605  // between satisfying guarantees and bursting above guarantees up to
606  // limits, or have a different sorting technique specifically for
607  // satisfying guarantees (e.g. MESOS-8026). This is tech debt from
608  // when a "quota role" was considered different from a "non-quota"
609  // role. However, they are the same, one just has a default quota.
610  //
611  // A dedicated sorter for roles that have a non-default quota.
612  // This sorter determines the order in which guarantees are allocated
613  // during Level 1 of the first stage. Since only non-revocable
614  // resources are available for quota, the total cluster non-revocable
615  // resources are used as the resource pool.
616  //
617  // NOTE: A role appears in `quotaRoleSorter` if it has a non-default
618  // quota (even if no frameworks are currently registered in that role).
619  // In contrast, `roleSorter` only contains entries for roles with one
620  // or more registered frameworks.
622 
623  // A collection of sorters, one per active role. Each sorter determines
624  // the order in which frameworks that belong to the same role are allocated
625  // resources inside the role's share. These sorters are used during Level 2
626  // for both the first and the second stages. Since frameworks are sharing
627  // the resources allocated to a role, the role's allocation is used as
628  // the resource pool for each role specific framework sorter.
630 
631  // Factory function for framework sorters.
632  const std::function<Sorter*()> frameworkSorterFactory;
633 
634 private:
635  bool isFrameworkTrackedUnderRole(
636  const FrameworkID& frameworkId,
637  const std::string& role) const;
638 
639  void trackFrameworkUnderRole(
640  const FrameworkID& frameworkId,
641  const std::string& role);
642 
643  void untrackFrameworkUnderRole(
644  const FrameworkID& frameworkId,
645  const std::string& role);
646 
647  // `trackReservations` and `untrackReservations` are helpers
648  // to track role resource reservations. We need to keep
649  // track of reservations to enforce role quota limit
650  // in the presence of unallocated reservations. See MESOS-4527.
651  //
652  // TODO(mzhu): Ideally, we want these helpers to instead track the
653  // reservations as *allocated* in the sorters even when the
654  // reservations have not been allocated yet. This will help to:
655  //
656  // (1) Solve the fairness issue when roles with unallocated
657  // reservations may game the allocator (See MESOS-8299).
658  //
659  // (2) Simplify the quota enforcement logic -- the allocator
660  // would no longer need to track reservations separately.
661  void trackReservations(
662  const hashmap<std::string, Resources>& reservations);
663 
664  void untrackReservations(
665  const hashmap<std::string, Resources>& reservations);
666 
667  // Helper to update the agent's total resources maintained in the allocator
668  // and the role and quota sorters (whose total resources match the agent's
669  // total resources). Returns true iff the stored agent total was changed.
670  bool updateSlaveTotal(const SlaveID& slaveId, const Resources& total);
671 
672  // Helper that returns true if the given agent is located in a
673  // different region than the master. This can only be the case if
674  // the agent and the master are both configured with a fault domain.
675  bool isRemoteSlave(const Slave& slave) const;
676 
677  // Helper function that checks if a framework is capable of
678  // receiving resources on the agent based on the framework capability.
679  //
680  // TODO(mzhu): Make this a `Framework` member function once we pull
681  // `struct Framework` out from being nested.
682  bool isCapableOfReceivingAgent(
683  const protobuf::framework::Capabilities& frameworkCapabilities,
684  const Slave& slave) const;
685 
686  // Helper function that removes any resources that the framework is not
687  // capable of receiving based on the given framework capability.
688  //
689  // TODO(mzhu): Make this a `Framework` member function once we pull
690  // `struct Framework` out from being nested.
691  Resources stripIncapableResources(
692  const Resources& resources,
693  const protobuf::framework::Capabilities& frameworkCapabilities) const;
694 
695  // Helper to track allocated resources on an agent.
696  void trackAllocatedResources(
697  const SlaveID& slaveId,
698  const FrameworkID& frameworkId,
699  const Resources& allocated);
700 
701  // Helper to untrack resources that are no longer allocated on an agent.
702  void untrackAllocatedResources(
703  const SlaveID& slaveId,
704  const FrameworkID& frameworkId,
705  const Resources& allocated);
706 
707  // Helper that removes all existing offer filters for the given slave
708  // id.
709  void removeFilters(const SlaveID& slaveId);
710 };
711 
712 
713 } // namespace internal {
714 
715 
716 // We map the templatized version of the `HierarchicalAllocatorProcess` to one
717 // that relies on sorter factories in the internal namespace. This allows us
718 // to keep the implementation of the allocator in the implementation file.
719 template <
720  typename RoleSorter,
721  typename FrameworkSorter,
722  typename QuotaRoleSorter>
725 {
726 public:
728  : ProcessBase(process::ID::generate("hierarchical-allocator")),
730  [this]() -> Sorter* {
731  return new RoleSorter(this->self(), "allocator/mesos/roles/");
732  },
733  []() -> Sorter* { return new FrameworkSorter(); },
734  []() -> Sorter* { return new QuotaRoleSorter(); }) {}
735 };
736 
737 } // namespace allocator {
738 } // namespace master {
739 } // namespace internal {
740 } // namespace mesos {
741 
742 #endif // __MASTER_ALLOCATOR_MESOS_HIERARCHICAL_HPP__
Option< process::Future< Nothing > > allocation
Definition: hierarchical.hpp:530
hashmap< SlaveID, hashset< InverseOfferFilter * > > inverseOfferFilters
Definition: hierarchical.hpp:97
Protocol< RecoverRequest, RecoverResponse > recover
HierarchicalAllocatorProcess< DRFSorter, DRFSorter, DRFSorter > HierarchicalDRFAllocatorProcess
Definition: hierarchical.hpp:57
std::string generate(const std::string &prefix="")
Returns &#39;prefix(N)&#39; where N represents the number of instances where the same prefix (wrt...
std::set< std::string > roles
Definition: hierarchical.hpp:87
mesos::allocator::Options options
Definition: hierarchical.hpp:480
Definition: nothing.hpp:16
Definition: option.hpp:28
T getOrElse(U &&u) const &
Definition: option.hpp:127
const Resources & getTotal() const
Definition: hierarchical.hpp:127
Maintenance(const Unavailability &_unavailability)
Definition: hierarchical.hpp:175
protobuf::framework::Capabilities capabilities
Definition: hierarchical.hpp:91
Definition: master.hpp:27
hashmap< std::string, process::Owned< Sorter > > frameworkSorters
Definition: hierarchical.hpp:629
BoundedHashMap< FrameworkID, process::Owned< FrameworkMetrics > > completedFrameworkMetrics
Definition: hierarchical.hpp:519
Definition: protobuf_utils.hpp:263
Framework(const FrameworkInfo &frameworkInfo, const std::set< std::string > &suppressedRoles, bool active, bool publishPerFrameworkMetrics)
HierarchicalAllocatorProcess< RandomSorter, RandomSorter, RandomSorter > HierarchicalRandomAllocatorProcess
Definition: hierarchical.hpp:66
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Option< int > expectedAgentCount
Definition: hierarchical.hpp:483
Definition: resources.hpp:81
Option< double > gpus() const
~HierarchicalAllocatorProcess() override
Definition: hierarchical.hpp:282
Pass in configuration to the allocator.
Definition: allocator.hpp:47
hashmap< SlaveID, Slave > slaves
Definition: hierarchical.hpp:521
MesosAllocator< HierarchicalRandomAllocatorProcess > HierarchicalRandomAllocator
Definition: hierarchical.hpp:69
process::Owned< Sorter > quotaRoleSorter
Definition: hierarchical.hpp:621
SlaveInfo info
Definition: hierarchical.hpp:161
bool hasGpu() const
Definition: hierarchical.hpp:133
MesosAllocator< HierarchicalDRFAllocatorProcess > HierarchicalDRFAllocator
Definition: hierarchical.hpp:63
const std::function< Sorter *()> frameworkSorterFactory
Definition: hierarchical.hpp:632
const Resources & getAllocated() const
Definition: hierarchical.hpp:129
bool activated
Definition: hierarchical.hpp:165
void unallocate(const Resources &toUnallocate)
Definition: hierarchical.hpp:150
Definition: hashmap.hpp:38
Slave(const SlaveInfo &_info, const protobuf::slave::Capabilities &_capabilities, bool _activated, const Resources &_total, const Resources &_allocated)
Definition: hierarchical.hpp:110
Definition: quota.hpp:25
lambda::function< void(const FrameworkID &, const hashmap< std::string, hashmap< SlaveID, Resources >> &)> offerCallback
Definition: hierarchical.hpp:488
bool active
Definition: hierarchical.hpp:99
Try< Nothing > unavailability(const Unavailability &unavailability)
process::Owned< Sorter > roleSorter
Definition: hierarchical.hpp:602
std::set< std::string > suppressedRoles
Definition: hierarchical.hpp:89
Try< Bytes > used(const std::string &path="/")
Definition: fs.hpp:43
Try< Nothing > initialize(const Flags &flags)
Initialized state for support of systemd functions in this file.
hashmap< FrameworkID, mesos::allocator::InverseOfferStatus > statuses
Definition: hierarchical.hpp:189
Result< std::vector< Filter< Classifier > > > filters(const std::string &_link, const Handle &parent)
Definition: internal.hpp:769
Definition: protobuf_utils.hpp:478
Definition: spec.hpp:26
hashmap< FrameworkID, Framework > frameworks
Definition: hierarchical.hpp:516
bool publishPerFrameworkMetrics
Definition: hierarchical.hpp:101
HierarchicalAllocatorProcess(const std::function< Sorter *()> &roleSorterFactory, const std::function< Sorter *()> &_frameworkSorterFactory, const std::function< Sorter *()> &quotaRoleSorterFactory)
Definition: hierarchical.hpp:270
process::Owned< FrameworkMetrics > metrics
Definition: hierarchical.hpp:103
Option< std::set< std::string > > fairnessExcludeResourceNames
Definition: hierarchical.hpp:553
Option< hashset< std::string > > whitelist
Definition: hierarchical.hpp:550
hashmap< std::string, hashset< FrameworkID > > roles
Definition: hierarchical.hpp:536
Option< DomainInfo > domain
Definition: hierarchical.hpp:559
hashset< SlaveID > allocationCandidates
Definition: hierarchical.hpp:526
Definition: boundedhashmap.hpp:27
const Resources & getAvailable() const
Definition: hierarchical.hpp:131
A "process identifier" used to uniquely identify a process when dispatching messages.
Definition: pid.hpp:279
Resources shared() const
Definition: none.hpp:27
Definition: attributes.hpp:24
void allocate(const Resources &toAllocate)
Definition: hierarchical.hpp:143
hashset< FrameworkID > offersOutstanding
Definition: hierarchical.hpp:195
Resources nonShared() const
Definition: executor.hpp:48
Unavailability unavailability
Definition: hierarchical.hpp:179
HierarchicalAllocatorProcess This
Definition: hierarchical.hpp:418
HierarchicalAllocatorProcess Self
Definition: hierarchical.hpp:417
Option< Maintenance > maintenance
Definition: hierarchical.hpp:201
Definition: owned.hpp:36
hashmap< std::string, Quota > quotas
Definition: hierarchical.hpp:540
hashmap< std::string, hashmap< SlaveID, hashset< OfferFilter * > > > offerFilters
Definition: hierarchical.hpp:96
protobuf::slave::Capabilities capabilities
Definition: hierarchical.hpp:163
hashmap< std::string, Resources > reservationScalarQuantities
Definition: hierarchical.hpp:547
void updateTotal(const Resources &newTotal)
Definition: hierarchical.hpp:135
lambda::function< void(const FrameworkID &, const hashmap< SlaveID, UnavailableResources > &)> inverseOfferCallback
Definition: hierarchical.hpp:493
Option< std::vector< Resources > > minAllocatableResources
Definition: hierarchical.hpp:562