Package eu.stratosphere.nephele.execution

Examples of eu.stratosphere.nephele.execution.RuntimeEnvironment


   */
  public void register(Task task) throws InsufficientResourcesException {
    // Check if we can safely run this task with the given buffers
    ensureBufferAvailability(task);

    RuntimeEnvironment environment = task.getRuntimeEnvironment();

    // -------------------------------------------------------------------------------------------------------------
    //                                       Register output channels
    // -------------------------------------------------------------------------------------------------------------

    environment.registerGlobalBufferPool(this.globalBufferPool);

    if (this.localBuffersPools.containsKey(task.getVertexID())) {
      throw new IllegalStateException("Vertex " + task.getVertexID() + " has a previous buffer pool owner");
    }

    for (OutputGate gate : environment.outputGates()) {
      // add receiver list hints
      for (OutputChannel channel : gate.channels()) {
        // register envelope dispatcher with the channel
        channel.registerEnvelopeDispatcher(this);

        switch (channel.getChannelType()) {
          case IN_MEMORY:
            addReceiverListHint(channel.getID(), channel.getConnectedId());
            break;
          case NETWORK:
            addReceiverListHint(channel.getConnectedId(), channel.getID());
            break;
        }

        this.channels.put(channel.getID(), channel);
      }
    }

    this.localBuffersPools.put(task.getVertexID(), environment);

    // -------------------------------------------------------------------------------------------------------------
    //                                       Register input channels
    // -------------------------------------------------------------------------------------------------------------

    // register global
    for (InputGate<?> gate : environment.inputGates()) {
      gate.registerGlobalBufferPool(this.globalBufferPool);

      for (int i = 0; i < gate.getNumberOfInputChannels(); i++) {
        InputChannel<? extends IOReadableWritable> channel = gate.getInputChannel(i);
        channel.registerEnvelopeDispatcher(this);
View Full Code Here


    this.configuration = configuration;
    this.executionSignature = signature;

    this.invokableClass = invokableClass;

    this.environment = new RuntimeEnvironment(executionGraph.getJobID(), name, invokableClass, configuration,
      executionGraph.getJobConfiguration());
  }
View Full Code Here

    // Make sure all tasks are fully registered before they are started
    for (final TaskDeploymentDescriptor tdd : tasks) {

      final JobID jobID = tdd.getJobID();
      final ExecutionVertexID vertexID = tdd.getVertexID();
      RuntimeEnvironment re;

      // retrieve the registered cache files from job configuration and create the local tmp file.
      Map<String, FutureTask<Path>> cpTasks = new HashMap<String, FutureTask<Path>>();
      for (Entry<String, String> e: DistributedCache.getCachedFile(tdd.getJobConfiguration())) {
        FutureTask<Path> cp = this.fileCache.createTmpFile(e.getKey(), e.getValue(), jobID);
        cpTasks.put(e.getKey(), cp);
      }

      try {
        re = new RuntimeEnvironment(tdd, this.memoryManager, this.ioManager, new TaskInputSplitProvider(jobID,
          vertexID, this.globalInputSplitProvider), this.accumulatorProtocolProxy, cpTasks);
      } catch (Throwable t) {
        final TaskSubmissionResult result = new TaskSubmissionResult(vertexID,
          AbstractTaskResult.ReturnCode.DEPLOYMENT_ERROR);
        result.setDescription(StringUtils.stringifyException(t));
        LOG.error(result.getDescription(), t);
        submissionResultList.add(result);
        continue;
      }

      final Configuration jobConfiguration = tdd.getJobConfiguration();

      // Register the task
      Task task;
      try {
        task = createAndRegisterTask(vertexID, jobConfiguration, re);
      } catch (InsufficientResourcesException e) {
        final TaskSubmissionResult result = new TaskSubmissionResult(vertexID,
          AbstractTaskResult.ReturnCode.INSUFFICIENT_RESOURCES);
        result.setDescription(e.getMessage());
        LOG.error(result.getDescription(), e);
        submissionResultList.add(result);
        continue;
      }

      if (task == null) {
        final TaskSubmissionResult result = new TaskSubmissionResult(vertexID,
          AbstractTaskResult.ReturnCode.TASK_NOT_FOUND);
        result.setDescription("Task " + re.getTaskNameWithIndex() + " (" + vertexID + ") was already running");
        LOG.error(result.getDescription());
        submissionResultList.add(result);
        continue;
      }
View Full Code Here

TOP

Related Classes of eu.stratosphere.nephele.execution.RuntimeEnvironment

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.