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

Class BalloonExecutor

src/examples/balloon_executor.cpp:156–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154
155
156class BalloonExecutor : public Executor
157{
158public:
159 BalloonExecutor()
160 : launched(false) {}
161
162 ~BalloonExecutor() override {}
163
164 void registered(ExecutorDriver* driver,
165 const ExecutorInfo& executorInfo,
166 const FrameworkInfo& frameworkInfo,
167 const SlaveInfo& slaveInfo) override
168 {
169 LOG(INFO) << "Registered";
170 }
171
172 void reregistered(ExecutorDriver* driver,
173 const SlaveInfo& slaveInfo) override
174 {
175 LOG(INFO) << "Reregistered";
176 }
177
178 void disconnected(ExecutorDriver* driver) override
179 {
180 LOG(INFO) << "Disconnected";
181 }
182
183 void launchTask(ExecutorDriver* driver, const TaskInfo& task) override
184 {
185 if (launched) {
186 TaskStatus status;
187 status.mutable_task_id()->MergeFrom(task.task_id());
188 status.set_state(TASK_FAILED);
189 status.set_message(
190 "Attempted to run multiple balloon tasks with the same executor");
191
192 driver->sendStatusUpdate(status);
193 return;
194 }
195
196 LOG(INFO) << "Starting task " << task.task_id().value();
197
198 // NOTE: The executor driver calls `launchTask` synchronously, which
199 // means that calls such as `driver->sendStatusUpdate()` will not execute
200 // until `launchTask` returns.
201 std::thread thread([=]() {
202 run(driver, task);
203 });
204
205 thread.detach();
206
207 launched = true;
208 }
209
210 void killTask(ExecutorDriver* driver, const TaskID& taskId) override
211 {
212 LOG(INFO) << "Kill task " << taskId.value();
213 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected