MCPcopy Create free account
hub / github.com/apache/mesos / MesosExecutorDriver

Class MesosExecutorDriver

include/mesos/executor.hpp:212–264  ·  view source on GitHub ↗

Concrete implementation of an ExecutorDriver that connects an Executor with a Mesos slave. The MesosExecutorDriver is thread-safe. The driver is responsible for invoking the Executor callbacks as it communicates with the Mesos slave. Note that blocking on the MesosExecutorDriver (e.g., via MesosExecutorDriver::join) doesn't affect the executor callbacks in anyway because they are handled by a di

Source from the content-addressed store, hash-verified

210// See src/examples/test_executor.cpp for an example of using the
211// MesosExecutorDriver.
212class MesosExecutorDriver : public ExecutorDriver
213{
214public:
215 // Creates a new driver that uses the specified Executor. Note, the
216 // executor pointer must outlive the driver.
217 //
218 // Note that the other constructor overload that accepts `environment`
219 // argument is preferable to this one in a multithreaded environment,
220 // because the implementation of this one accesses global environment
221 // which is unsafe due to a potential concurrent modification of the
222 // environment by another thread.
223 explicit MesosExecutorDriver(Executor* executor);
224
225 // Creates a new driver that uses the specified `Executor` and environment
226 // variables. Note, the executor pointer must outlive the driver.
227 explicit MesosExecutorDriver(
228 Executor* executor,
229 const std::map<std::string, std::string>& environment);
230
231 // This destructor will block indefinitely if
232 // MesosExecutorDriver::start was invoked successfully (possibly via
233 // MesosExecutorDriver::run) and MesosExecutorDriver::stop has not
234 // been invoked.
235 ~MesosExecutorDriver() override;
236
237 // See ExecutorDriver for descriptions of these.
238 Status start() override;
239 Status stop() override;
240 Status abort() override;
241 Status join() override;
242 Status run() override;
243 Status sendStatusUpdate(const TaskStatus& status) override;
244 Status sendFrameworkMessage(const std::string& data) override;
245
246private:
247 friend class internal::ExecutorProcess;
248
249 Executor* executor;
250
251 // Libprocess process for communicating with slave.
252 internal::ExecutorProcess* process;
253
254 // Mutex for enforcing serial execution of all non-callbacks.
255 std::recursive_mutex mutex;
256
257 // Latch for waiting until driver terminates.
258 process::Latch* latch;
259
260 // Current status of the driver.
261 Status status;
262
263 std::map<std::string, std::string> environment;
264};
265
266} // namespace mesos {
267

Callers 1

test_executor.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected