Package edu.berkeley.sparrow.thrift

Examples of edu.berkeley.sparrow.thrift.TPlacementPreference$TPlacementPreferenceTupleScheme


      TTaskSpec spec = new TTaskSpec();
      spec.setTaskId(Integer.toString((new Random().nextInt())));
      spec.setMessage(message.array());
      if (numPreferredNodes > 0) {
        Collections.shuffle(backends);
        TPlacementPreference preference = new TPlacementPreference();
        for (int i = 0; i < numPreferredNodes; i++) {
          preference.addToNodes(backends.get(i));
        }
        spec.setPreference(preference);
      }
      out.add(spec);
    }
View Full Code Here


      TTaskSpec spec = new TTaskSpec();
      spec.setTaskId(Integer.toString((new Random().nextInt())));
      spec.setMessage(message.array());
      if (numPreferredNodes > 0) {
        Collections.shuffle(backends);
        TPlacementPreference preference = new TPlacementPreference();
        for (int i = 0; i < numPreferredNodes; i++) {
          preference.addToNodes(backends.get(i));
        }
        spec.setPreference(preference);
      }
      out.add(spec);
    }
View Full Code Here

    for (int i = 0; i < req.getTasksSize(); i++) {
      TTaskSpec task = req.getTasks().get(i);
      TTaskSpec newTask = new TTaskSpec();
      newTask.message = task.message;
      newTask.taskId = task.taskId;
      newTask.preference = new TPlacementPreference();
      newTask.preference.addToNodes(backends.get(i).getHostName());
      newReq.addToTasks(newTask);
    }
    LOG.info("New request: " + newReq);
    return newReq;
View Full Code Here

    // Set up a simple configuration that logs on the console.
    BasicConfigurator.configure();
    tasks = Lists.newArrayList();
    taskIds = Sets.newHashSet();
    ByteBuffer message = ByteBuffer.allocate(1);
    TPlacementPreference placementPreference = new TPlacementPreference();
    for (int i = 0; i < NUM_TASKS; ++i) {
      String id = "test task " + i;
      taskIds.add(id);
      tasks.add(new TTaskSpec(id, placementPreference, message));
    }
View Full Code Here

  public void enqueueTaskReservationsWithMoreReservationsThanNodes() {
  final double PROBE_RATIO = 2;
  final int NUM_TASKS = 14;

    ByteBuffer message = ByteBuffer.allocate(1);
    TPlacementPreference placementPreference = new TPlacementPreference();
    while (tasks.size() < NUM_TASKS) {
      String id = "test task " + tasks.size();
      taskIds.add(id);
      tasks.add(new TTaskSpec(id, placementPreference, message));
    }
View Full Code Here

    // preferredNodesList[2] in their placement preferences).
    ByteBuffer message = ByteBuffer.allocate(1);
    List<TTaskSpec> tasks = new ArrayList<TTaskSpec>();
    final int NUM_TASKS = 3;
    for (int i = 0; i < NUM_TASKS; ++i) {
      TPlacementPreference placementPreference = new TPlacementPreference();
      for (int j = i; j < i + 3; ++j) {
        placementPreference.addToNodes(preferredNodesList.get(j).getAddress().getHostAddress());
      }
      String id = "test task " + i;
      tasks.add(new TTaskSpec(id, placementPreference, message));
    }
View Full Code Here

    preferredNodes.add(new InetSocketAddress("123.4.5.6", 20000));
    preferredNodes.add(new InetSocketAddress("7.0.0.9", 45));

    // Create a single task with three placement preferences.
    ByteBuffer message = ByteBuffer.allocate(1);
    TPlacementPreference placementPreference = new TPlacementPreference();
    for (InetSocketAddress address : preferredNodes) {
      placementPreference.addToNodes(address.getAddress().getHostAddress());
    }
    TTaskSpec task = new TTaskSpec("test task", placementPreference, message);

    // Create the scheduling request.
    List<TTaskSpec> tasks = new ArrayList<TTaskSpec>();
View Full Code Here

    ByteBuffer message = ByteBuffer.allocate(1);
    List<TTaskSpec> tasks = new ArrayList<TTaskSpec>();
    final int NUM_TASKS = 3;
    Set<String> constrainedTaskIds = new HashSet<String>();
    for (int i = 0; i < NUM_TASKS; ++i) {
      TPlacementPreference placementPreference = new TPlacementPreference();
      for (int j = i; j < i + 3; ++j) {
        placementPreference.addToNodes(preferredNodes.get(j).getAddress().getHostAddress());
      }
      String id = "constrained test task " + i;
      constrainedTaskIds.add(id);
      tasks.add(new TTaskSpec(id, placementPreference, message));
    }
View Full Code Here

      TTaskSpec spec = new TTaskSpec();
      spec.setTaskId(Integer.toString((new Random().nextInt())));
      spec.setMessage(message.array());
      if (numPreferredNodes > 0) {
        Collections.shuffle(backends);
        TPlacementPreference preference = new TPlacementPreference();
        for (int i = 0; i < numPreferredNodes; i++) {
          preference.addToNodes(backends.get(i));
        }
        spec.setPreference(preference);
      }
      out.add(spec);
    }
View Full Code Here

TOP

Related Classes of edu.berkeley.sparrow.thrift.TPlacementPreference$TPlacementPreferenceTupleScheme

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.