Package eu.stratosphere.nephele.jobmanager.scheduler

Examples of eu.stratosphere.nephele.jobmanager.scheduler.SchedulingException


        final Map.Entry<InstanceType, Integer> entry = it.next();

        final InstanceTypeDescription descr = availableInstances.get(entry.getKey());
        if (descr == null) {
          throw new SchedulingException("Unable to schedule job: No instance of type " + entry.getKey()
              + " available");
        }

        if (descr.getMaximumNumberOfAvailableInstances() != -1
            && descr.getMaximumNumberOfAvailableInstances() < entry.getValue().intValue()) {
          throw new SchedulingException("Unable to schedule job: " + entry.getValue().intValue()
              + " instances of type " + entry.getKey() + " required, but only "
              + descr.getMaximumNumberOfAvailableInstances() + " are available");
        }
      }
    }

    // Subscribe to job status notifications
    executionGraph.registerJobStatusListener(this);

    // Set state of each vertex for scheduled
    final ExecutionGraphIterator it2 = new ExecutionGraphIterator(executionGraph, true);
    while (it2.hasNext()) {

      final ExecutionVertex vertex = it2.next();
      vertex.registerExecutionListener(new LocalExecutionListener(this, vertex));
    }

    // Register the scheduler as an execution stage listener
    executionGraph.registerExecutionStageListener(this);

    // Add job to the job queue (important to add job to queue before requesting instances)
    synchronized (this.jobQueue) {
      this.jobQueue.add(executionGraph);
    }

    // Request resources for the first stage of the job

    final ExecutionStage executionStage = executionGraph.getCurrentExecutionStage();
    try {
      requestInstances(executionStage);
    } catch (InstanceException e) {
      final String exceptionMessage = StringUtils.stringifyException(e);
      LOG.error(exceptionMessage);
      this.jobQueue.remove(executionGraph);
      throw new SchedulingException(exceptionMessage);
    }
  }
View Full Code Here


        final Map.Entry<InstanceType, Integer> entry = it.next();

        final InstanceTypeDescription descr = availableInstances.get(entry.getKey());
        if (descr == null) {
          throw new SchedulingException("Unable to schedule job: No instance of type " + entry.getKey()
              + " available");
        }

        if (descr.getMaximumNumberOfAvailableInstances() != -1
            && descr.getMaximumNumberOfAvailableInstances() < entry.getValue().intValue()) {
          throw new SchedulingException("Unable to schedule job: " + entry.getValue().intValue()
              + " instances of type " + entry.getKey() + " required, but only "
              + descr.getMaximumNumberOfAvailableInstances() + " are available");
        }
      }
    }

    // Subscribe to job status notifications
    executionGraph.registerJobStatusListener(this);

    // Register execution listener for each vertex
    final ExecutionGraphIterator it2 = new ExecutionGraphIterator(executionGraph, true);
    while (it2.hasNext()) {

      final ExecutionVertex vertex = it2.next();
      vertex.registerExecutionListener(new QueueExecutionListener(this, vertex));
    }

    // Register the scheduler as an execution stage listener
    executionGraph.registerExecutionStageListener(this);

    // Add job to the job queue (important to add job to queue before requesting instances)
    synchronized (this.jobQueue) {
      this.jobQueue.add(executionGraph);
    }

    // Request resources for the first stage of the job

    final ExecutionStage executionStage = executionGraph.getCurrentExecutionStage();
    try {
      requestInstances(executionStage);
    } catch (InstanceException e) {
      final String exceptionMessage = StringUtils.stringifyException(e);
      LOG.error(exceptionMessage);
      this.jobQueue.remove(executionGraph);
      throw new SchedulingException(exceptionMessage);
    }
  }
View Full Code Here

TOP

Related Classes of eu.stratosphere.nephele.jobmanager.scheduler.SchedulingException

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.