Package edu.berkeley.sparrow.daemon.nodemonitor.TaskScheduler

Examples of edu.berkeley.sparrow.daemon.nodemonitor.TaskScheduler.TaskSpec


    // Make sure that tasks are launched right away, if resources are available.
    scheduler.submitTaskReservations(createTaskReservationRequest(1, scheduler, testApp),
                                     backendAddress);
    assertEquals(1, scheduler.runnableTasks());
    TaskSpec task = scheduler.getNextTask();
    assertEquals("1", task.requestId);
    assertEquals(0, scheduler.runnableTasks());

    scheduler.submitTaskReservations(createTaskReservationRequest(2, scheduler, testApp),
                                     backendAddress);
View Full Code Here


    completedTasks.add(fullTaskId);
    fullTaskId.requestId = "1";

    scheduler.tasksFinished(completedTasks);
    assertEquals(1, scheduler.runnableTasks());
    TaskSpec task = scheduler.getNextTask();
    assertEquals("5", task.requestId);
    assertEquals(0, scheduler.runnableTasks());

    fullTaskId.requestId = task.requestId;
    scheduler.tasksFinished(completedTasks);
View Full Code Here

    scheduler.getNextTask();
    assertEquals(0, scheduler.runnableTasks());

    scheduler.submitTaskReservations(createTaskReservationRequest(1, scheduler, user2), address2);
    assertEquals(1, scheduler.runnableTasks());
    TaskSpec user2Task = scheduler.getNextTask();
    assertEquals(0, scheduler.runnableTasks());

    scheduler.submitTaskReservations(createTaskReservationRequest(1, scheduler, user3), address3);
    assertEquals(1, scheduler.runnableTasks());
    scheduler.getNextTask();
    assertEquals(0, scheduler.runnableTasks());

    scheduler.submitTaskReservations(createTaskReservationRequest(1, scheduler, user4), address4);
    assertEquals(1, scheduler.runnableTasks());
    scheduler.getNextTask();
    assertEquals(0, scheduler.runnableTasks());

    /* Create the following backlogs.
     * user1: 2 tasks
     * user2: 3 tasks
     * user3: 4 tasks
     */
    scheduler.submitTaskReservations(
        createTaskReservationRequest(2, scheduler, user1), address1);
    scheduler.submitTaskReservations(
        createTaskReservationRequest(1, scheduler, user2), address2);
    scheduler.submitTaskReservations(
        createTaskReservationRequest(1, scheduler, user2), address2);
    scheduler.submitTaskReservations(
        createTaskReservationRequest(1, scheduler, user2), address2);
    scheduler.submitTaskReservations(
        createTaskReservationRequest(4, scheduler, user3), address3);

    assertEquals(0, scheduler.runnableTasks());

    // If the getTask() for user 2 fails, the scheduler should try to get another task
    // for that user rather than using the usual round-robin ordering.
    scheduler.noTaskForReservation(user2Task);
    assertEquals(1, scheduler.runnableTasks());
    user2Task = scheduler.getNextTask();
    assertEquals(user2, user2Task.user.user);
    assertEquals("6", user2Task.requestId);
    assertEquals(0, scheduler.runnableTasks());

    // The scheduler should resume round-robin from user 1 (and not start the round-robin
    // again after user 2).
    TFullTaskId fullTaskId = new TFullTaskId();
    fullTaskId.taskId = "";
    List<TFullTaskId> completedTasks = Lists.newArrayList();
    completedTasks.add(fullTaskId);
    fullTaskId.requestId = "1";

    scheduler.tasksFinished(completedTasks);
    assertEquals(1, scheduler.runnableTasks());
    TaskSpec task = scheduler.getNextTask();
    assertEquals(user1, task.user.user);
    assertEquals("5", task.requestId);
    assertEquals(0, scheduler.runnableTasks());

    // If the scheduler eventually exhausts the queue of tasks for user 2, and cannot launch any,
View Full Code Here

    scheduler.submitTaskReservations(
        createTaskReservationRequest(2, scheduler, user, 1), appBackendAddress);
    scheduler.submitTaskReservations(
        createTaskReservationRequest(1, scheduler, user, 0), appBackendAddress);

    TaskSpec task = scheduler.getNextTask();
    assertEquals("1", task.requestId);
    assertEquals(3, scheduler.runnableTasks());
    task = scheduler.getNextTask();
    assertEquals("1", task.requestId);
    assertEquals(2, scheduler.runnableTasks());
View Full Code Here

    private HashMap<InetSocketAddress, BackendService.Client> backendClients = Maps.newHashMap();

    @Override
    public void run() {
      while (true) {
        TaskSpec task = scheduler.getNextTask(); // blocks until task is ready

        List<TTaskLaunchSpec> taskLaunchSpecs = executeGetTaskRpc(task);
        AUDIT_LOG.info(Logging.auditEventString("node_monitor_get_task_complete", task.requestId,
            nodeMonitorInternalAddress.getHost()));
View Full Code Here

TOP

Related Classes of edu.berkeley.sparrow.daemon.nodemonitor.TaskScheduler.TaskSpec

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.