Apache Mesos
proxy_scheduler.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 PROXY_SCHEDULER_HPP
18 #define PROXY_SCHEDULER_HPP
19 
20 // Python.h must be included before standard headers.
21 // See: http://docs.python.org/2/c-api/intro.html#include-files
22 #include <Python.h>
23 
24 #include <string>
25 #include <vector>
26 
27 #include <mesos/scheduler.hpp>
28 
29 namespace mesos {
30 namespace python {
31 
32 struct MesosSchedulerDriverImpl;
33 
37 class ProxyScheduler : public Scheduler
38 {
39 public:
40  explicit ProxyScheduler(MesosSchedulerDriverImpl* _impl) : impl(_impl) {}
41 
42  virtual ~ProxyScheduler() {}
43 
44  virtual void registered(SchedulerDriver* driver,
45  const FrameworkID& frameworkId,
46  const MasterInfo& masterInfo);
47  virtual void reregistered(SchedulerDriver* driver,
48  const MasterInfo& masterInfo);
49  virtual void disconnected(SchedulerDriver* driver);
50  virtual void resourceOffers(SchedulerDriver* driver,
51  const std::vector<Offer>& offers);
52  virtual void offerRescinded(SchedulerDriver* driver, const OfferID& offerId);
53  virtual void statusUpdate(SchedulerDriver* driver, const TaskStatus& status);
54  virtual void frameworkMessage(SchedulerDriver* driver,
55  const ExecutorID& executorId,
56  const SlaveID& slaveId,
57  const std::string& data);
58  virtual void slaveLost(SchedulerDriver* driver, const SlaveID& slaveId);
59  virtual void executorLost(SchedulerDriver* driver,
60  const ExecutorID& executorId,
61  const SlaveID& slaveId,
62  int status);
63  virtual void error(SchedulerDriver* driver, const std::string& message);
64 
65 private:
67 };
68 
69 } // namespace python {
70 } // namespace mesos {
71 
72 #endif // PROXY_SCHEDULER_HPP
virtual void statusUpdate(SchedulerDriver *driver, const TaskStatus &status)
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
ProxyScheduler(MesosSchedulerDriverImpl *_impl)
Definition: proxy_scheduler.hpp:40
Python object structure for MesosSchedulerDriverImpl objects.
Definition: mesos_scheduler_driver_impl.hpp:30
Definition: scheduler.hpp:185
virtual void disconnected(SchedulerDriver *driver)
virtual void executorLost(SchedulerDriver *driver, const ExecutorID &executorId, const SlaveID &slaveId, int status)
virtual void resourceOffers(SchedulerDriver *driver, const std::vector< Offer > &offers)
Definition: spec.hpp:26
Definition: scheduler.hpp:69
virtual void frameworkMessage(SchedulerDriver *driver, const ExecutorID &executorId, const SlaveID &slaveId, const std::string &data)
virtual void offerRescinded(SchedulerDriver *driver, const OfferID &offerId)
virtual void error(SchedulerDriver *driver, const std::string &message)
virtual ~ProxyScheduler()
Definition: proxy_scheduler.hpp:42
Proxy Scheduler implementation that will call into Python.
Definition: proxy_scheduler.hpp:37
virtual void slaveLost(SchedulerDriver *driver, const SlaveID &slaveId)
virtual void reregistered(SchedulerDriver *driver, const MasterInfo &masterInfo)
virtual void registered(SchedulerDriver *driver, const FrameworkID &frameworkId, const MasterInfo &masterInfo)