本文整理汇总了C++中TaskStatus::has_labels方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskStatus::has_labels方法的具体用法?C++ TaskStatus::has_labels怎么用?C++ TaskStatus::has_labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskStatus
的用法示例。
在下文中一共展示了TaskStatus::has_labels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: None
virtual Result<Labels> slaveTaskStatusLabelDecorator(
const FrameworkID& frameworkId,
const TaskStatus& status)
{
LOG(INFO) << "CalicoHook::task status label decorator";
if (!status.has_executor_id()) {
LOG(WARNING) << "CalicoHook:: task status has no valid executor id";
return None();
}
const ExecutorID executorId = status.executor_id();
if (!executors->contains(executorId)) {
LOG(WARNING) << "CalicoHook:: no valid container id for: " << executorId;
return None();
}
const ContainerID containerId = executors->at(executorId);
if (infos == NULL || !infos->contains(containerId)) {
LOG(WARNING) << "CalicoHook:: no valid infos for: " << containerId;
return None();
}
const Info* info = (*infos)[containerId];
if (info->ipAddress.isNone()) {
LOG(WARNING) << "CalicoHook:: no valid IP address";
return None();
}
Labels labels;
if (status.has_labels()) {
labels.CopyFrom(status.labels());
}
// Set IPAddress label.
Label* label = labels.add_labels();
label->set_key(ipAddressLabelKey);
label->set_value(info->ipAddress.get());
LOG(INFO) << "CalicoHook:: added label "
<< label->key() << ":" << label->value();
return labels;
}