Package edu.berkeley.sparrow.thrift

Examples of edu.berkeley.sparrow.thrift.TSchedulingRequest$TSchedulingRequestStandardScheme


        }
        List<TTaskSpec> tasks = generateJob(tasksPerJob, benchmarkId, benchmarkIterations);
        TUserGroupInfo user = new TUserGroupInfo();
        user.setUser("*");
        user.setGroup("*");
        TSchedulingRequest req = new TSchedulingRequest();
        req.setApp("testApp");
        req.setTasks(tasks);
        req.setUser(user);

        TNonblockingTransport tr = new TNonblockingSocket(
            "localhost", schedulerPort);
        SchedulerService.AsyncClient client = new SchedulerService.AsyncClient(
            factory, manager, tr);
View Full Code Here


    if (specialCaseIndex < 1 || specialCaseIndex > 3) {
      LOG.error("Invalid special case index: " + specialCaseIndex);
    }

    // No tasks have preferences and we have the magic number of tasks
    TSchedulingRequest newReq = new TSchedulingRequest();
    newReq.user = req.user;
    newReq.app = req.app;
    newReq.probeRatio = req.probeRatio;

    List<InetSocketAddress> allBackends = Lists.newArrayList();
    List<InetSocketAddress> backends = Lists.newArrayList();
    // We assume the below always returns the same order (invalid assumption?)
    for (InetSocketAddress backend : state.getBackends(req.app)) {
      allBackends.add(backend);
    }

    // Each time this is called, we restrict to 1/3 of the nodes in the cluster
    for (int i = 0; i < allBackends.size(); i++) {
      if (i % 3 == specialCaseIndex - 1) {
        backends.add(allBackends.get(i));
      }
    }
    Collections.shuffle(backends);

    if (!(allBackends.size() >= (req.getTasks().size() * 3))) {
      LOG.error("Special case expects at least three times as many machines as tasks.");
      return null;
    }
    LOG.info(backends);
    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

      String id = "test task " + tasks.size();
      taskIds.add(id);
      tasks.add(new TTaskSpec(id, placementPreference, message));
    }

    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);
   
    final int NUM_ITERATIONS = 100;
    for (int i = 0; i < NUM_ITERATIONS; ++i) {
      UnconstrainedTaskPlacer taskPlacer = new UnconstrainedTaskPlacer(REQUEST_ID, PROBE_RATIO);
View Full Code Here

   * Calls getEnqueueTaskReservations() for two tasks, with 6 possible backend nodes, and ensures
   * that the reservations returned are for distinct nodes in the set of backends.
   */
  @Test
  public void sanityCheckEnqueueTaskReservations() {
    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);

    final int NUM_ITERATIONS = 100;
    for (int i = 0; i < NUM_ITERATIONS; ++i) {
      UnconstrainedTaskPlacer taskPlacer = new UnconstrainedTaskPlacer(REQUEST_ID, PROBE_RATIO);

View Full Code Here

   * assignTasks() for the backends returned by getEnqueueTaskReservationsRequests() and ensures
   * that the tasks returned are consistent with the original scheduling request.
   */
  @Test
  public void testAssignTask() {
    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);

    final int numIterations = 100;
    final int expectedReservations = 3;
    for (int i = 0; i < numIterations; ++i) {
      UnconstrainedTaskPlacer taskPlacer = new UnconstrainedTaskPlacer(REQUEST_ID, PROBE_RATIO);
View Full Code Here

   * assignTasks() to calls of allTasksPlaced() to ensure that allTasksPlaced() returns
   * the correct answer.
   */
  @Test
  public void testAllTasksPlaced() {
    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);

    final int numIterations = 100;
    final int expectedReservations = 3;
    for (int i = 0; i < numIterations; ++i) {
      UnconstrainedTaskPlacer taskPlacer = new UnconstrainedTaskPlacer(REQUEST_ID, PROBE_RATIO);
View Full Code Here

    }
  }

  @Test
  public void testCancellation() {
    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);

    final int numIterations = 100;
    for (int i = 0; i < numIterations; ++i) {
      UnconstrainedTaskPlacer taskPlacer = new UnconstrainedTaskPlacer(REQUEST_ID, PROBE_RATIO);
      Map<InetSocketAddress, TEnqueueTaskReservationsRequest> requests =
View Full Code Here

      }
      String id = "test task " + i;
      tasks.add(new TTaskSpec(id, placementPreference, message));
    }

    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);

    // Create list of available backend nodes, with some additional nodes in addition to the
    // preferred ones.
    allBackends.addAll(preferredNodes);
    allBackends.add(new InetSocketAddress("1.2.3.4", 345));
View Full Code Here

    TTaskSpec task = new TTaskSpec("test task", placementPreference, message);

    // Create the scheduling request.
    List<TTaskSpec> tasks = new ArrayList<TTaskSpec>();
    tasks.add(task);
    TSchedulingRequest schedulingRequest = new TSchedulingRequest(APP_ID, tasks, user);

    // Create a set of backends, including all of the preferred nodes and some extra nodes too.
    allBackends.add(new InetSocketAddress("3.4.5.6", 174));
    for (InetSocketAddress node : preferredNodes) {
      allBackends.add(node);
View Full Code Here

   * Creates a scheduling request with 3 tasks, and sanity checks the result of
   * getEnqueueTaskReservationsRequests()
   */
  @Test
  public void testMultipleTasks() {
    TSchedulingRequest schedulingRequest = generateSchedulingRequests();

    for (int i = 0; i < ITERATIONS; ++i) {
      ConstrainedTaskPlacer taskPlacer = new ConstrainedTaskPlacer(REQUEST_ID, 2);

      Map<InetSocketAddress, TEnqueueTaskReservationsRequest> requests =
View Full Code Here

TOP

Related Classes of edu.berkeley.sparrow.thrift.TSchedulingRequest$TSchedulingRequestStandardScheme

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.