Package eu.stratosphere.nephele.executiongraph

Examples of eu.stratosphere.nephele.executiongraph.ExecutionStage


    final Iterator<ExecutionStage> stageIt = executionGraph.iterator();
    while (stageIt.hasNext()) {

      final InstanceRequestMap instanceRequestMap = new InstanceRequestMap();
      final ExecutionStage stage = stageIt.next();
      stage.collectRequiredInstanceTypes(instanceRequestMap, ExecutionState.CREATED);

      // Iterator over required Instances
      final Iterator<Map.Entry<InstanceType, Integer>> it = instanceRequestMap.getMinimumIterator();
      while (it.hasNext()) {

        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);
View Full Code Here


    final Iterator<ExecutionStage> stageIt = executionGraph.iterator();
    while (stageIt.hasNext()) {

      final InstanceRequestMap instanceRequestMap = new InstanceRequestMap();
      final ExecutionStage stage = stageIt.next();
      stage.collectRequiredInstanceTypes(instanceRequestMap, ExecutionState.CREATED);

      // Iterator over required Instances
      final Iterator<Map.Entry<InstanceType, Integer>> it = instanceRequestMap.getMinimumIterator();
      while (it.hasNext()) {

        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);
View Full Code Here

   *        the execution graph to collect the vertices from
   */
  public void deployAssignedInputVertices(final ExecutionGraph executionGraph) {

    final Map<AbstractInstance, List<ExecutionVertex>> verticesToBeDeployed = new HashMap<AbstractInstance, List<ExecutionVertex>>();
    final ExecutionStage executionStage = executionGraph.getCurrentExecutionStage();

    final Set<ExecutionVertex> alreadyVisited = new HashSet<ExecutionVertex>();

    for (int i = 0; i < executionStage.getNumberOfStageMembers(); ++i) {

      final ExecutionGroupVertex startVertex = executionStage.getStageMember(i);
      if (!startVertex.isInputVertex()) {
        continue;
      }

      for (int j = 0; j < startVertex.getCurrentNumberOfGroupMembers(); ++j) {
View Full Code Here

       * {@inheritDoc}
       */
      @Override
      public void run() {

        final ExecutionStage stage = eg.getCurrentExecutionStage();

        synchronized (stage) {

          for (final AllocatedResource allocatedResource : allocatedResources) {

            AllocatedResource resourceToBeReplaced = null;
            // Important: only look for instances to be replaced in the current stage
            final Iterator<ExecutionGroupVertex> groupIterator = new ExecutionGroupVertexIterator(eg, true,
              stage.getStageNumber());
            while (groupIterator.hasNext()) {

              final ExecutionGroupVertex groupVertex = groupIterator.next();
              for (int i = 0; i < groupVertex.getCurrentNumberOfGroupMembers(); ++i) {

View Full Code Here

  }

  protected void replayCheckpointsFromPreviousStage(final ExecutionGraph executionGraph) {

    final int currentStageIndex = executionGraph.getIndexOfCurrentExecutionStage();
    final ExecutionStage previousStage = executionGraph.getStage(currentStageIndex - 1);

    final List<ExecutionVertex> verticesToBeReplayed = new ArrayList<ExecutionVertex>();

    for (int i = 0; i < previousStage.getNumberOfOutputExecutionVertices(); ++i) {

      final ExecutionVertex vertex = previousStage.getOutputExecutionVertex(i);
      vertex.updateExecutionState(ExecutionState.ASSIGNED);
      verticesToBeReplayed.add(vertex);
    }

    deployAssignedVertices(verticesToBeReplayed);
View Full Code Here

      if (js != InternalJobStatus.FAILING && js != InternalJobStatus.FAILED) {

        // TODO: Fix this
        // deployAssignedVertices(eg);

        final ExecutionStage stage = eg.getCurrentExecutionStage();

        try {
          requestInstances(stage);
        } catch (InstanceException e) {
          e.printStackTrace();
View Full Code Here

TOP

Related Classes of eu.stratosphere.nephele.executiongraph.ExecutionStage

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.