Package edu.berkeley.sparrow.thrift

Examples of edu.berkeley.sparrow.thrift.TTaskLaunchSpec$TTaskLaunchSpecStandardSchemeFactory


    Collections.shuffle(nodeList);
    if (reservationsToLaunch < nodeList.size())
      nodeList = nodeList.subList(0, reservationsToLaunch);

    for (TTaskSpec task : schedulingRequest.getTasks()) {
      TTaskLaunchSpec taskLaunchSpec = new TTaskLaunchSpec(task.getTaskId(),
                                                           task.bufferForMessage());
      unlaunchedTasks.add(taskLaunchSpec);
    }

    HashMap<InetSocketAddress, TEnqueueTaskReservationsRequest> requests = Maps.newHashMap();
View Full Code Here


    if (unlaunchedTasks.isEmpty()) {
      LOG.debug("Request " + requestId + ", node monitor " + nodeMonitorAddress.toString() +
               ": Not assigning a task (no remaining unlaunched tasks).");
      return Lists.newArrayList();
    } else {
      TTaskLaunchSpec launchSpec = unlaunchedTasks.get(0);
      unlaunchedTasks.remove(0);
      LOG.debug("Request " + requestId + ", node monitor " + nodeMonitorAddress.toString() +
                ": Assigning task");
      return Lists.newArrayList(launchSpec);
    }
View Full Code Here

        continue;
      }

      List<InetSocketAddress> preferredNodes = taskPreferencesToSocketList(task, addrToSocket);

      TTaskLaunchSpec taskLaunchSpec = new TTaskLaunchSpec(task.getTaskId(),
                                                           task.bufferForMessage());

      int numEnqueuedNodes = 0;
      for (InetSocketAddress addr : preferredNodes) {
        THostPort hostPort = new THostPort(addr.getAddress().getHostAddress(), addr.getPort());
View Full Code Here

      LOG.error("Trying to launch more reservations than there are nodes; this use case is not " +
                "currently supported");
    }

    for (TTaskSpec task : unconstrainedTasks) {
      TTaskLaunchSpec taskLaunchSpec = new TTaskLaunchSpec(
          task.getTaskId(), task.bufferForMessage());
      unlaunchedUnconstrainedTasks.add(taskLaunchSpec);
    }

  }
View Full Code Here

      outstandingReservations.remove(nodeMonitorAddress);
    } else {
      outstandingReservations.put(nodeMonitorAddress, numOutstandingReservations - 1);
    }

    TTaskLaunchSpec taskSpec = getConstrainedTask(nodeMonitorAddress);
    if (taskSpec != null) {
      this.launchedConstrainedTasks.add(taskSpec);
      LOG.debug("Request " + requestId + ", node monitor " + nodeMonitorAddress.toString() +
          ": Assigning task.");
      --numRemainingTasks;
View Full Code Here

          "; attempting to launch an unconstrained task).");
      return null;
    }

    while (!taskSpecs.isEmpty()) {
      TTaskLaunchSpec currentSpec = taskSpecs.remove(0);
      if (!this.launchedConstrainedTasks.contains(currentSpec)) {
        return currentSpec;
      }
    }
    LOG.debug("Request " + requestId + ", node monitor " + nodeMonitorAddress.toString() +
View Full Code Here

    if (this.unlaunchedUnconstrainedTasks.size() == 0) {
      LOG.debug("Request " + requestId + ", node monitor " + nodeMonitorAddress.toString() +
                ": Not assigning a task (no remaining unconstrained unlaunched tasks)");
      return Lists.newArrayList();
    }
    TTaskLaunchSpec spec = unlaunchedUnconstrainedTasks.get(0);
    unlaunchedUnconstrainedTasks.remove(0);
    LOG.debug("Request " + requestId + ", node monitor " + nodeMonitorAddress.toString() +
              ": Assigning task " + spec.getTaskId());
    return Lists.newArrayList(spec);
  }
View Full Code Here

        THostPort hostPort = new THostPort(nodes.get(j).getHostName(), nodes.get(j).getPort());
        List<TTaskLaunchSpec> specs = taskPlacer.assignTask(hostPort);
        assertTrue(specs != null);
        if (j < NUM_TASKS) {
          assertEquals(specs.size(), 1);
          TTaskLaunchSpec spec = specs.get(0);
          assertTrue("Expect to receive a task spec for task " + j + " at " +
                     hostPort.getHost() + ":" + hostPort.getPort(), spec != null);
          assertTrue("Expect list of unlaunched tasks to contain " + spec.getTaskId(),
                     taskIdsCopy.contains(spec.getTaskId()));
          taskIdsCopy.remove(spec.getTaskId());
        } else {
          assertEquals(specs.size(), 0);
        }
      }
    }
View Full Code Here

        THostPort hostPort = new THostPort(nodes.get(j).getHostName(), nodes.get(j).getPort());
        List<TTaskLaunchSpec> specs = taskPlacer.assignTask(hostPort);
        assertTrue(specs != null);
        if (j < NUM_TASKS) {
          assertEquals(1, specs.size());
          TTaskLaunchSpec spec = specs.get(0);
          assertTrue("Expect to receive a task spec for task " + j + " at " +
                     hostPort.getHost() + ":" + hostPort.getPort(), spec != null);
          assertTrue("Expect list of unlaunched tasks to contain " + spec.getTaskId(),
                     taskIdsCopy.contains(spec.getTaskId()));
          taskIdsCopy.remove(spec.getTaskId());
        } else {
          assertTrue(taskPlacer.allTasksPlaced());
          assertEquals(0, specs.size());
        }
      }
View Full Code Here

          assertEquals(specs.size(), 1);
        }
        if (specs.size() == 1) {
          assertTrue("assignTask() returned a task after all tasks were launched!",
              unlaunchedTaskIds.size() > 0);
          TTaskLaunchSpec spec = specs.get(0);
          assertTrue(spec != null);
          assertTrue(unlaunchedTaskIds.contains(spec.getTaskId()));
          unlaunchedTaskIds.remove(spec.getTaskId());
        }

        // If all of the tasks have been launched, cancel the outstanding ones.
        if (unlaunchedTaskIds.size() == 0 && cancellations == null) {
          assertTrue(taskPlacer.allTasksPlaced());
View Full Code Here

TOP

Related Classes of edu.berkeley.sparrow.thrift.TTaskLaunchSpec$TTaskLaunchSpecStandardSchemeFactory

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.