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


C++ MesosSchedulerDriver类代码示例

本文整理汇总了C++中MesosSchedulerDriver的典型用法代码示例。如果您正苦于以下问题:C++ MesosSchedulerDriver类的具体用法?C++ MesosSchedulerDriver怎么用?C++ MesosSchedulerDriver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MesosSchedulerDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: scheduler_reviveOffers

SchedulerDriverStatus scheduler_reviveOffers(SchedulerPtrPair state)
{
    assert(state.driver != NULL);

    MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
    return driver->reviveOffers();
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:7,代码来源:scheduler_c_api.cpp

示例2: scheduler_declineOffer

SchedulerDriverStatus scheduler_declineOffer(
    SchedulerDriverPtr driver,
    ProtobufObj* offerId,
    ProtobufObj* filters)
{
  TRACE("scheduler_declineOffer()\n");
  assert(driver != NULL);
  assert(offerId != NULL);

  MesosSchedulerDriver* mdriver =
      reinterpret_cast<MesosSchedulerDriver*>(driver);

  Filters filters_;
  if (filters != NULL && filters->data != NULL) {
    if (!utils::deserialize<Filters>(filters_, filters)) {
      return DRIVER_ABORTED;
    }
  }

  OfferID offer;
  if (!utils::deserialize<OfferID>(offer, offerId)) {
    return DRIVER_ABORTED;
  }

  return mdriver->declineOffer(offer, filters_);
}
开发者ID:duzhanyuan,项目名称:gopark,代码行数:26,代码来源:scheduler_driver.cpp

示例3: scheduler_launchTasks

SchedulerDriverStatus scheduler_launchTasks(
    SchedulerDriverPtr driver,
    ProtobufObj* offerId,
    ProtobufObj* tasks,
    ProtobufObj* filters)
{
  TRACE("scheduler_launchTasks()\n");
  assert(driver != NULL);
  assert(offerId != NULL);
  assert(tasks != NULL);

  MesosSchedulerDriver* mdriver =
      reinterpret_cast<MesosSchedulerDriver*>(driver);

  OfferID offer;
  if (!utils::deserialize<OfferID>(offer, offerId)) {
    return DRIVER_ABORTED;
  }

  vector<TaskInfo> taskInfos;
  if (!utils::deserialize<TaskInfo>(taskInfos, tasks)) {
    return DRIVER_ABORTED;
  }

  Filters filters_;
  if (filters != NULL && filters->data != NULL) {
    if (!utils::deserialize<Filters>(filters_, filters)) {
      return DRIVER_ABORTED;
    }
  }

  TRACE("scheduler_launchTasks start()\n");
  return mdriver->launchTasks(offer, taskInfos, filters_);
}
开发者ID:duzhanyuan,项目名称:gopark,代码行数:34,代码来源:scheduler_driver.cpp

示例4: scheduler_stop

SchedulerDriverStatus scheduler_stop(SchedulerDriverPtr driver, int failover)
{
  TRACE("scheduler_stop()\n");
  assert(driver != NULL);

  MesosSchedulerDriver* mdriver =
      reinterpret_cast<MesosSchedulerDriver*>(driver);

  return mdriver->stop(failover);
}
开发者ID:duzhanyuan,项目名称:gopark,代码行数:10,代码来源:scheduler_driver.cpp

示例5: scheduler_reviveOffers

SchedulerDriverStatus scheduler_reviveOffers(SchedulerDriverPtr driver)
{
  TRACE("scheduler_reviveOffers()\n");
  assert(driver != NULL);

  MesosSchedulerDriver* mdriver =
      reinterpret_cast<MesosSchedulerDriver*>(driver);

  return mdriver->reviveOffers();
}
开发者ID:duzhanyuan,项目名称:gopark,代码行数:10,代码来源:scheduler_driver.cpp

示例6: scheduler_killTask

SchedulerDriverStatus scheduler_killTask(SchedulerPtrPair state, ErlNifBinary* taskId)
{
    assert(state.driver != NULL);
    assert(taskId != NULL);  
    TaskID taskid_pb;

    if(!deserialize<TaskID>(taskid_pb,taskId)) { return DRIVER_ABORTED; };

    MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
    return driver->killTask(taskid_pb);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:11,代码来源:scheduler_c_api.cpp

示例7: scheduler_reconcileTasks

SchedulerDriverStatus scheduler_reconcileTasks(SchedulerPtrPair state, BinaryNifArray* taskStatus)
{
  assert(state.driver != NULL);
  assert(taskStatus != NULL);

  vector<TaskStatus> taskStatus_;
  if(! deserialize<TaskStatus>( taskStatus_, taskStatus)) {return DRIVER_ABORTED;};

  MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
  return driver->reconcileTasks(taskStatus_);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:11,代码来源:scheduler_c_api.cpp

示例8: main

int main(int argc, char** argv)
{
  if (argc != 2) {
    cerr << "Usage: " << argv[0] << " <master>" << endl;
    return -1;
  }

  DockerNoExecutorScheduler scheduler;

  FrameworkInfo framework;
  framework.set_user(""); // Have Mesos fill in the current user.
  framework.set_name("Docker No Executor Framework (C++)");
  framework.set_checkpoint(true);

  MesosSchedulerDriver* driver;
  if (os::getenv("MESOS_AUTHENTICATE_FRAMEWORKS").isSome()) {
    cout << "Enabling authentication for the framework" << endl;

    Option<string> value = os::getenv("DEFAULT_PRINCIPAL");
    if (value.isNone()) {
      EXIT(EXIT_FAILURE)
        << "Expecting authentication principal in the environment";
    }

    Credential credential;
    credential.set_principal(value.get());

    framework.set_principal(value.get());

    value = os::getenv("DEFAULT_SECRET");
    if (value.isNone()) {
      EXIT(EXIT_FAILURE)
        << "Expecting authentication secret in the environment";
    }

    credential.set_secret(value.get());

    driver = new MesosSchedulerDriver(
        &scheduler, framework, argv[1], credential);
  } else {
    framework.set_principal("no-executor-framework-cpp");

    driver = new MesosSchedulerDriver(
        &scheduler, framework, argv[1]);
  }

  int status = driver->run() == DRIVER_STOPPED ? 0 : 1;

  // Ensure that the driver process terminates.
  driver->stop();

  delete driver;
  return status;
}
开发者ID:BonnieTang,项目名称:mesos,代码行数:54,代码来源:docker_no_executor_framework.cpp

示例9: scheduler_stop

SchedulerDriverStatus scheduler_stop(SchedulerPtrPair state, int failover)
{
    assert(state.driver != NULL);
    
    MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
    if(failover){
      return driver->stop(true);
    }else{
      return driver->stop(false);
    }
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:11,代码来源:scheduler_c_api.cpp

示例10: scheduler_requestResources

SchedulerDriverStatus scheduler_requestResources(SchedulerPtrPair state, BinaryNifArray* requests)
{
  assert(state.driver != NULL);
  assert(requests != NULL);

  vector<Request> requests_;

  if(! deserialize<Request>( requests_, requests)) {return DRIVER_ABORTED;};

  MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
  return driver->requestResources(requests_);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:12,代码来源:scheduler_c_api.cpp

示例11: main

int main(int argc, char** argv)
{
  if (argc != 2) {
    cerr << "Usage: " << argv[0] << " <master>" << endl;
    return -1;
  }

  NoExecutorScheduler scheduler;

  FrameworkInfo framework;
  framework.set_user(""); // Have Mesos fill in the current user.
  framework.set_name("No Executor Framework (C++)");

  // TODO(vinod): Make checkpointing the default when it is default
  // on the slave.
  if (os::hasenv("MESOS_CHECKPOINT")) {
    cout << "Enabling checkpoint for the framework" << endl;
    framework.set_checkpoint(true);
  }

  MesosSchedulerDriver* driver;
  if (os::hasenv("MESOS_AUTHENTICATE")) {
    cout << "Enabling authentication for the framework" << endl;

    if (!os::hasenv("DEFAULT_PRINCIPAL")) {
      EXIT(1) << "Expecting authentication principal in the environment";
    }

    if (!os::hasenv("DEFAULT_SECRET")) {
      EXIT(1) << "Expecting authentication secret in the environment";
    }

    Credential credential;
    credential.set_principal(getenv("DEFAULT_PRINCIPAL"));
    credential.set_secret(getenv("DEFAULT_SECRET"));

    driver = new MesosSchedulerDriver(
        &scheduler, framework, argv[1], credential);
  } else {
    driver = new MesosSchedulerDriver(
        &scheduler, framework, argv[1]);
  }

  int status = driver->run() == DRIVER_STOPPED ? 0 : 1;

  // Ensure that the driver process terminates.
  driver->stop();

  delete driver;
  return status;
}
开发者ID:AsylumCorp,项目名称:mesos,代码行数:51,代码来源:no_executor_framework.cpp

示例12: scheduler_declineOffer

SchedulerDriverStatus scheduler_declineOffer(SchedulerPtrPair state, ErlNifBinary* offerId, ErlNifBinary* filters)
 {
    assert(state.driver != NULL);
    assert(offerId != NULL);

    OfferID offerid_pb;
    Filters filter_pb;

    if(!deserialize<OfferID>(offerid_pb,offerId)) { return DRIVER_ABORTED; };
    if(!deserialize<Filters>(filter_pb,filters)) { return DRIVER_ABORTED; };

    MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
    return driver->declineOffer(offerid_pb,
                              filter_pb);
 }
开发者ID:nqn,项目名称:erlang-mesos,代码行数:15,代码来源:scheduler_c_api.cpp

示例13: scheduler_killTask

SchedulerDriverStatus scheduler_killTask(
    SchedulerDriverPtr driver,
    ProtobufObj* taskIdMessage)
{
  TRACE("scheduler_killTask()\n");

  MesosSchedulerDriver* mdriver =
      reinterpret_cast<MesosSchedulerDriver*>(driver);
  assert(driver != NULL);
  assert(taskIdMessage != NULL);

  TaskID taskId;
  if (!utils::deserialize<TaskID>(taskId, taskIdMessage)) {
    return DRIVER_ABORTED;
  }

  return mdriver->killTask(taskId);
}
开发者ID:duzhanyuan,项目名称:gopark,代码行数:18,代码来源:scheduler_driver.cpp

示例14: scheduler_requestResources

SchedulerDriverStatus scheduler_requestResources(
    SchedulerDriverPtr driver,
    ProtobufObj* requests)
{
  TRACE("scheduler_requestResources()\n");
  assert(driver != NULL);
  assert(requests != NULL);

  MesosSchedulerDriver* mdriver =
      reinterpret_cast<MesosSchedulerDriver*>(driver);

  vector<Request> requests_;
  if (!utils::deserialize<Request>(requests_, requests)) {
    return DRIVER_ABORTED;
  }

  return mdriver->requestResources(requests_);
}
开发者ID:duzhanyuan,项目名称:gopark,代码行数:18,代码来源:scheduler_driver.cpp

示例15: scheduler_sendFrameworkMessage

SchedulerDriverStatus scheduler_sendFrameworkMessage(SchedulerPtrPair state, 
                                                    ErlNifBinary* executorId, 
                                                    ErlNifBinary* slaveId, 
                                                    const char* data)
{
    assert(state.driver != NULL);
    assert(executorId != NULL);
    assert(slaveId != NULL);
    assert(data != NULL);    

    ExecutorID executorid_pb;
    SlaveID slaveid_pb;

    if(!deserialize<ExecutorID>(executorid_pb,executorId)) { return DRIVER_ABORTED; };
    if(!deserialize<SlaveID>(slaveid_pb,slaveId)) { return DRIVER_ABORTED; };

    MesosSchedulerDriver* driver = reinterpret_cast<MesosSchedulerDriver*> (state.driver);
    return driver->sendFrameworkMessage(executorid_pb, slaveid_pb, data);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:19,代码来源:scheduler_c_api.cpp


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