当前位置: 首页>>代码示例>>C++>>正文


C++ TaskStatus::labels方法代码示例

本文整理汇总了C++中TaskStatus::labels方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskStatus::labels方法的具体用法?C++ TaskStatus::labels怎么用?C++ TaskStatus::labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskStatus的用法示例。


在下文中一共展示了TaskStatus::labels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
    }
开发者ID:joestein,项目名称:net-modules,代码行数:43,代码来源:network_isolator.cpp

示例2: slaveTaskStatusDecorator

  virtual Result<TaskStatus> slaveTaskStatusDecorator(
      const FrameworkID& frameworkId,
      const TaskStatus& status)
  {
    LOG(INFO) << "Executing 'slaveTaskStatusDecorator' hook";

    Labels labels;

    // Set one known label.
    Label* newLabel = labels.add_labels();
    newLabel->set_key("bar");
    newLabel->set_value("qux");

    // Remove label which was set by test.
    foreach (const Label& oldLabel, status.labels().labels()) {
      if (oldLabel.key() != "foo") {
        labels.add_labels()->CopyFrom(oldLabel);
      }
    }

    TaskStatus result;
    result.mutable_labels()->CopyFrom(labels);

    // Set an IP address, a network isolation group, and a known label
    // in network info. This data is later validated by the
    // 'HookTest.VerifySlaveTaskStatusDecorator' test.
    NetworkInfo* networkInfo =
      result.mutable_container_status()->add_network_infos();
    // TODO(CD): Deprecated -- remove after 0.27.0.
    networkInfo->set_ip_address("4.3.2.1");
    NetworkInfo::IPAddress* ipAddress =
      networkInfo->add_ip_addresses();
    ipAddress->set_ip_address("4.3.2.1");
    networkInfo->add_groups("public");

    Label* networkInfoLabel = networkInfo->mutable_labels()->add_labels();
    networkInfoLabel->set_key("net_foo");
    networkInfoLabel->set_value("net_bar");

    return result;
  }
开发者ID:AbheekG,项目名称:mesos,代码行数:41,代码来源:test_hook_module.cpp

示例3: slaveTaskStatusLabelDecorator

  virtual Result<Labels> slaveTaskStatusLabelDecorator(
      const FrameworkID& frameworkId,
      const TaskStatus& status)
  {
    LOG(INFO) << "Executing 'slaveTaskStatusLabelDecorator' hook";

    Labels labels;

    // Set one known label.
    Label* newLabel = labels.add_labels();
    newLabel->set_key("bar");
    newLabel->set_value("qux");

    // Remove label which was set by test.
    foreach (const Label& oldLabel, status.labels().labels()) {
      if (oldLabel.key() != "foo") {
        labels.add_labels()->CopyFrom(oldLabel);
      }
    }

    return labels;
  }
开发者ID:JessicaLHartog,项目名称:mesos,代码行数:22,代码来源:test_hook_module.cpp


注:本文中的TaskStatus::labels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。