MCPcopy Create free account
hub / github.com/apache/mesos / operator()

Method operator()

src/slave/http.cpp:211–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209 framework_(framework) {}
210
211 void operator()(JSON::ObjectWriter* writer) const
212 {
213 writer->field("id", executor_->id.value());
214 writer->field("name", executor_->info.name());
215 writer->field("source", executor_->info.source());
216 writer->field("container", executor_->containerId.value());
217 writer->field("directory", executor_->directory);
218 writer->field("resources", executor_->allocatedResources());
219
220 // Resources may be empty for command executors.
221 if (!executor_->info.resources().empty()) {
222 // Executors are not allowed to mix resources allocated to
223 // different roles, see MESOS-6636.
224 writer->field(
225 "role",
226 executor_->info.resources().begin()->allocation_info().role());
227 }
228
229 if (executor_->info.has_labels()) {
230 writer->field("labels", executor_->info.labels());
231 }
232
233 if (executor_->info.has_type()) {
234 writer->field("type", ExecutorInfo::Type_Name(executor_->info.type()));
235 }
236
237 writer->field("tasks", [this](JSON::ArrayWriter* writer) {
238 foreachvalue (Task* task, executor_->launchedTasks) {
239 if (!approvers_->approved<VIEW_TASK>(*task, framework_->info)) {
240 continue;
241 }
242
243 writer->element(*task);
244 }
245 });
246
247 writer->field("queued_tasks", [this](JSON::ArrayWriter* writer) {
248 foreachvalue (const TaskInfo& task, executor_->queuedTasks) {
249 if (!approvers_->approved<VIEW_TASK>(task, framework_->info)) {
250 continue;
251 }
252
253 writer->element(task);
254 }
255 });
256
257 writer->field("completed_tasks", [this](JSON::ArrayWriter* writer) {
258 foreach (const std::shared_ptr<Task>& task, executor_->completedTasks) {
259 if (!approvers_->approved<VIEW_TASK>(*task, framework_->info)) {
260 continue;
261 }
262
263 writer->element(*task);
264 }
265
266 // NOTE: We add 'terminatedTasks' to 'completed_tasks' for
267 // simplicity.
268 foreachvalue (Task* task, executor_->terminatedTasks) {

Callers

nothing calls this directly

Calls 10

fieldMethod · 0.80
allocatedResourcesMethod · 0.80
typeMethod · 0.80
elementMethod · 0.80
foreachvalueFunction · 0.70
valueMethod · 0.45
nameMethod · 0.45
emptyMethod · 0.45
resourcesMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected