17 #ifndef __MESOS_SCHEDULER_HPP__ 18 #define __MESOS_SCHEDULER_HPP__ 26 #include <mesos/scheduler/scheduler.pb.h> 43 class SchedulerDriver;
50 class SchedulerProcess;
80 virtual void registered(
82 const FrameworkID& frameworkId,
83 const MasterInfo& masterInfo) = 0;
89 virtual void reregistered(
91 const MasterInfo& masterInfo) = 0;
110 virtual void resourceOffers(
112 const std::vector<Offer>& offers) = 0;
120 virtual void offerRescinded(
122 const OfferID& offerId) = 0;
135 virtual void statusUpdate(
137 const TaskStatus&
status) = 0;
142 virtual void frameworkMessage(
144 const ExecutorID& executorId,
145 const SlaveID& slaveId,
146 const std::string& data) = 0;
155 virtual void slaveLost(
157 const SlaveID& slaveId) = 0;
166 virtual void executorLost(
168 const ExecutorID& executorId,
169 const SlaveID& slaveId,
177 const std::string& message) = 0;
195 virtual Status
start() = 0;
205 virtual Status stop(
bool failover =
false) = 0;
214 virtual Status abort() = 0;
220 virtual Status
join() = 0;
223 virtual Status
run() = 0;
229 virtual Status requestResources(
const std::vector<Request>& requests) = 0;
245 virtual Status launchTasks(
246 const std::vector<OfferID>& offerIds,
247 const std::vector<TaskInfo>& tasks,
248 const Filters&
filters = Filters()) = 0;
251 virtual Status launchTasks(
252 const OfferID& offerId,
253 const std::vector<TaskInfo>& tasks,
254 const Filters&
filters = Filters()) = 0;
261 virtual Status killTask(
const TaskID& taskId) = 0;
274 virtual Status acceptOffers(
275 const std::vector<OfferID>& offerIds,
276 const std::vector<Offer::Operation>& operations,
277 const Filters&
filters = Filters()) = 0;
284 virtual Status declineOffer(
285 const OfferID& offerId,
286 const Filters&
filters = Filters()) = 0;
295 virtual Status reviveOffers() = 0;
303 virtual Status reviveOffers(
const std::vector<std::string>& roles) = 0;
314 virtual Status suppressOffers() = 0;
321 virtual Status suppressOffers(
const std::vector<std::string>& roles) = 0;
328 virtual Status acknowledgeStatusUpdate(
329 const TaskStatus&
status) = 0;
334 virtual Status sendFrameworkMessage(
335 const ExecutorID& executorId,
336 const SlaveID& slaveId,
337 const std::string& data) = 0;
345 virtual Status reconcileTasks(
346 const std::vector<TaskStatus>& statuses) = 0;
366 virtual Status updateFramework(
367 const FrameworkInfo& frameworkInfo,
368 const std::vector<std::string>& suppressedRoles,
369 ::mesos::scheduler::OfferConstraints&& offerConstraints) = 0;
422 const FrameworkInfo& framework,
423 const std::string&
master);
429 const FrameworkInfo& framework,
430 const std::string& master,
431 const Credential& credential);
442 const FrameworkInfo& framework,
443 const std::string& master,
444 bool implicitAcknowledgements);
448 const FrameworkInfo& framework,
449 const std::string& master,
450 bool implicitAcknowlegements,
451 const Credential& credential);
457 const FrameworkInfo& framework,
458 const std::vector<std::string>& suppressedRoles,
459 const std::string& master,
460 bool implicitAcknowledgements);
464 const FrameworkInfo& framework,
465 const std::vector<std::string>& suppressedRoles,
466 const std::string& master,
467 bool implicitAcknowlegements,
468 const Credential& credential);
478 Status
start()
override;
479 Status stop(
bool failover =
false)
override;
480 Status abort()
override;
481 Status
join()
override;
482 Status
run()
override;
484 Status requestResources(
485 const std::vector<Request>& requests)
override;
490 const OfferID& offerId,
491 const std::vector<TaskInfo>& tasks,
492 const Filters&
filters = Filters())
override;
495 const std::vector<OfferID>& offerIds,
496 const std::vector<TaskInfo>& tasks,
497 const Filters&
filters = Filters())
override;
499 Status killTask(
const TaskID& taskId)
override;
502 const std::vector<OfferID>& offerIds,
503 const std::vector<Offer::Operation>& operations,
504 const Filters&
filters = Filters())
override;
507 const OfferID& offerId,
508 const Filters&
filters = Filters())
override;
510 Status reviveOffers()
override;
512 Status reviveOffers(
const std::vector<std::string>& roles)
override;
514 Status suppressOffers()
override;
516 Status suppressOffers(
const std::vector<std::string>& roles)
override;
518 Status acknowledgeStatusUpdate(
519 const TaskStatus&
status)
override;
521 Status sendFrameworkMessage(
522 const ExecutorID& executorId,
523 const SlaveID& slaveId,
524 const std::string& data)
override;
526 Status reconcileTasks(
527 const std::vector<TaskStatus>& statuses)
override;
529 Status updateFramework(
530 const FrameworkInfo& frameworkInfo,
531 const std::vector<std::string>& suppressedRoles,
532 ::mesos::scheduler::OfferConstraints&& offerConstraints)
537 std::shared_ptr<master::detector::MasterDetector>
detector;
543 FrameworkInfo framework;
544 const std::vector<std::string> initialSuppressedRoles;
548 internal::SchedulerProcess*
process;
554 std::recursive_mutex mutex;
562 const bool implicitAcknowlegements;
564 const Credential* credential;
567 std::string schedulerId;
572 #endif // __MESOS_SCHEDULER_HPP__ Definition: master.hpp:27
virtual ~SchedulerDriver()
Definition: scheduler.hpp:191
bool initialize(const Option< std::string > &delegate=None(), const Option< std::string > &readwriteAuthenticationRealm=None(), const Option< std::string > &readonlyAuthenticationRealm=None())
Initialize the library.
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: scheduler.hpp:399
std::string join(const std::string &path1, const std::string &path2, const char _separator=os::PATH_SEPARATOR)
Definition: path.hpp:116
virtual ~Scheduler()
Definition: scheduler.hpp:74
Try< Nothing > start(const std::string &name)
Starts the slice with the given name (via 'systemctl start <name>').
Definition: scheduler.hpp:186
Result< std::vector< Filter< Classifier > > > filters(const std::string &_link, const Handle &parent)
Definition: internal.hpp:769
Definition: scheduler.hpp:70
Future< R > run(R(*method)())
Definition: run.hpp:55
std::shared_ptr< master::detector::MasterDetector > detector
Definition: scheduler.hpp:537
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
Definition: attributes.hpp:24
std::string error(const std::string &msg, uint32_t code)
Definition: executor.hpp:48