• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Filters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Filters类属于org.apache.mesos.Protos包,在下文中一共展示了Filters类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: launchTasks

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status launchTasks(final OfferID offerId, final Collection<TaskInfo> tasks)
{
    checkNotNull(offerId, "offerId is null");
    checkNotNull(tasks, "tasks is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final LaunchTasksMessage message = LaunchTasksMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .addOfferIds(offerId)
        .addAllTasks(tasks)
        .setFilters(Filters.newBuilder().build())
        .build();

    doLaunchTasks(message);
    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:21,代码来源:InternalSchedulerDriver.java


示例2: declineOffer

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status declineOffer(final OfferID offerId, final Filters filters)
{
    checkNotNull(offerId, "offerId is null");
    checkNotNull(filters, "filters is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final LaunchTasksMessage message = LaunchTasksMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .addOfferIds(offerId)
        .setFilters(filters)
        .build();

    doLaunchTasks(message);
    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:20,代码来源:InternalSchedulerDriver.java


示例3: launchTasks

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status launchTasks(
    Collection<OfferID> offerIds,
    Collection<TaskInfo> tasks,
    Filters filters) {

  throw new UnsupportedOperationException();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:9,代码来源:FakeMaster.java


示例4: acceptOffers

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status acceptOffers(
    Collection<OfferID> offerIds,
    Collection<Offer.Operation> operations,
    Filters filters) {
  throw new UnsupportedOperationException();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:8,代码来源:FakeMaster.java


示例5: declineOffer

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status declineOffer(OfferID offerId, Filters filters) {
  assertNotStopped();

  throw new UnsupportedOperationException();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:7,代码来源:FakeMaster.java


示例6: launchTasks

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status launchTasks(Collection<OfferID> offerIds, Collection<TaskInfo> tasks, Filters filters) {
  return null;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:5,代码来源:MockSchedulerDriver.java


示例7: acceptOffers

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status acceptOffers(Collection<OfferID> offerIds, Collection<Operation> operations, Filters filters) {
  return null;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:5,代码来源:MockSchedulerDriver.java


示例8: declineOffer

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
@Override
public Status declineOffer(OfferID offerId, Filters filters) {
  return null;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:5,代码来源:MockSchedulerDriver.java


示例9: doResourceRequest

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
/**
 * Greedily acquire resources by launching a Mesos Task(w/ our custom MesosExecutor) on REEF Evaluator request.
 * Either called from onResourceRequest(for a new request) or resourceOffers(for an outstanding request).
 * TODO[JIRA REEF-102]: reflect priority and rack/node locality specified in resourceRequestEvent.
 */
private synchronized void doResourceRequest(final ResourceRequestEvent resourceRequestEvent) {
  int tasksToLaunchCounter = resourceRequestEvent.getResourceCount();

  for (final Offer offer : this.offers.values()) {
    final int cpuSlots = getCpu(offer) / resourceRequestEvent.getVirtualCores().get();
    final int memSlots = getMemory(offer) / resourceRequestEvent.getMemorySize().get();
    final int taskNum = Math.min(Math.min(cpuSlots, memSlots), tasksToLaunchCounter);

    if (taskNum > 0 && satisfySlaveConstraint(resourceRequestEvent, offer)) {
      final List<TaskInfo> tasksToLaunch = new ArrayList<>();
      tasksToLaunchCounter -= taskNum;

      // Launch as many MesosTasks on the same node(offer) as possible to exploit locality.
      for (int j = 0; j < taskNum; j++) {
        final String id = offer.getId().getValue() + "-" + String.valueOf(j);
        final String executorLaunchCommand = getExecutorLaunchCommand(id, resourceRequestEvent.getMemorySize().get());

        final ExecutorInfo executorInfo = ExecutorInfo.newBuilder()
            .setExecutorId(ExecutorID.newBuilder()
                .setValue(id)
                .build())
            .setCommand(CommandInfo.newBuilder()
                .setValue(executorLaunchCommand)
                .addUris(URI.newBuilder().setValue(reefTarUri).build())
                .build())
            .build();

        final TaskInfo taskInfo = TaskInfo.newBuilder()
            .setTaskId(TaskID.newBuilder()
                .setValue(id)
                .build())
            .setName(id)
            .setSlaveId(offer.getSlaveId())
            .addResources(Resource.newBuilder()
                    .setName("mem")
                    .setType(Type.SCALAR)
                    .setScalar(Value.Scalar.newBuilder()
                            .setValue(resourceRequestEvent.getMemorySize().get())
                            .build())
                    .build())
            .addResources(Resource.newBuilder()
                    .setName("cpus")
                    .setType(Type.SCALAR)
                    .setScalar(Value.Scalar.newBuilder()
                            .setValue(resourceRequestEvent.getVirtualCores().get())
                            .build())
                    .build())
            .setExecutor(executorInfo)
            .build();

        tasksToLaunch.add(taskInfo);
        this.executorIdToLaunchedRequests.put(id, resourceRequestEvent);
      }

      final Filters filters = Filters.newBuilder().setRefuseSeconds(0).build();
      mesosMaster.launchTasks(Collections.singleton(offer.getId()), tasksToLaunch, filters);
    } else {
      mesosMaster.declineOffer(offer.getId());
    }
  }

  // the offers are no longer valid(all launched or declined)
  this.offers.clear();

  // Save leftovers that couldn't be launched
  outstandingRequests.add(ResourceRequestEventImpl.newBuilder()
      .mergeFrom(resourceRequestEvent)
      .setResourceCount(tasksToLaunchCounter)
      .build());
}
 
开发者ID:apache,项目名称:reef,代码行数:76,代码来源:REEFScheduler.java


示例10: createMesosTask

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
private void createMesosTask(Offer offer, Request request) {
  final String slaveName = request.request.slave.name;
  TaskID taskId = TaskID.newBuilder().setValue(slaveName).build();

  LOGGER.fine("Launching task " + taskId.getValue() + " with URI " +
              joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX));

  if (isExistingTask(taskId)) {
      refuseOffer(offer);
      return;
  }

  Jenkins jenkins = getJenkins();
  for (final Computer computer : jenkins.getComputers()) {
      if (!MesosComputer.class.isInstance(computer)) {
          LOGGER.finer("Not a mesos computer, skipping");
          continue;
      }

      MesosComputer mesosComputer = (MesosComputer) computer;
      MesosSlave mesosSlave = mesosComputer.getNode();

      if (taskId.getValue().equals(computer.getName()) && mesosSlave.isPendingDelete()) {
          LOGGER.info("This mesos task " + taskId.getValue() + " is pending deletion. Not launching another task");
          driver.declineOffer(offer.getId());
      }
  }

  CommandInfo.Builder commandBuilder = getCommandInfoBuilder(request);
  TaskInfo.Builder taskBuilder = getTaskInfoBuilder(offer, request, taskId, commandBuilder);

  if (request.request.slaveInfo.getContainerInfo() != null) {
      getContainerInfoBuilder(offer, request, slaveName, taskBuilder);
  }

  List<TaskInfo> tasks = new ArrayList<TaskInfo>();
  tasks.add(taskBuilder.build());
  Filters filters = Filters.newBuilder().setRefuseSeconds(1).build();
  driver.launchTasks(offer.getId(), tasks, filters);

  results.put(taskId, new Result(request.result, new Mesos.JenkinsSlave(offer.getSlaveId()
      .getValue())));
  finishedTasks.add(taskId);
}
 
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:45,代码来源:JenkinsScheduler.java


示例11: launchNewTask

import org.apache.mesos.Protos.Filters; //导入依赖的package包/类
/**
 * Launches a new Kibana task for the given elasticSearchUrl, using the offer
 *
 * @param requirement the requirement for the task
 * @param offer       the offer used to run the task
 * @param driver      the driver used to launch the task
 */
private void launchNewTask(Map.Entry<String, Integer> requirement, Offer offer, SchedulerDriver driver) {
    TaskInfo task = TaskInfoFactory.buildTask(requirement, offer, configuration);
    configuration.registerTask(requirement.getKey(), task.getTaskId());
    Filters filters = Filters.newBuilder().setRefuseSeconds(1).build();
    driver.launchTasks(Arrays.asList(offer.getId()), Arrays.asList(task), filters);
}
 
开发者ID:Praqma,项目名称:mesos-kibana,代码行数:14,代码来源:KibanaScheduler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Utils类代码示例发布时间:2022-05-23
下一篇:
Java ManagedAttribute类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap