Package org.apache.flink.runtime.execution

Examples of org.apache.flink.runtime.execution.Environment


   *
   * @param executionId the ID of the task to be unregistered
   * @param task the task to be unregistered
   */
  public void unregister(ExecutionAttemptID executionId, Task task) {
    final Environment environment = task.getEnvironment();
    if (environment == null) {
      return;
    }

    // destroy and remove OUTPUT channels from registered channels and cache
    for (ChannelID id : environment.getOutputChannelIDs()) {
      Channel channel = this.channels.remove(id);
      if (channel != null) {
        channel.destroy();
        this.receiverCache.remove(channel);
      }
    }

    // destroy and remove INPUT channels from registered channels and cache
    for (ChannelID id : environment.getInputChannelIDs()) {
      Channel channel = this.channels.remove(id);
      if (channel != null) {
        channel.destroy();
        this.receiverCache.remove(channel);
      }
    }

    // clear and remove INPUT side buffer pools
    for (GateID id : environment.getInputGateIDs()) {
      LocalBufferPoolOwner bufferPool = this.localBuffersPools.remove(id);
      if (bufferPool != null) {
        bufferPool.clearLocalBufferPool();
      }
    }
View Full Code Here


   *
   * @param task task to be executed
   * @throws InsufficientResourcesException thrown if not enough buffers available to execute the task
   */
  private void ensureBufferAvailability(Task task) throws InsufficientResourcesException {
    Environment env = task.getEnvironment();

    int numBuffers = this.globalBufferPool.numBuffers();
    // existing channels + channels of the task
    int numChannels = this.channels.size() + env.getNumberOfOutputChannels() + env.getNumberOfInputChannels();

    // need at least one buffer per channel
    if (numChannels > 0 && numBuffers / numChannels < 1) {
      String msg = String.format("%s has not enough buffers to safely execute %s (%d buffers missing)",
          this.connectionInfo.getFQDNHostname(), env.getTaskName(), numChannels - numBuffers);

      throw new InsufficientResourcesException(msg);
    }
  }
View Full Code Here

    // Collect profiling information of the threads
    synchronized (this.monitoredThreads) {

      final Iterator<Environment> iterator = this.monitoredThreads.keySet().iterator();
      while (iterator.hasNext()) {
        final Environment environment = iterator.next();
        final EnvironmentThreadSet environmentThreadSet = this.monitoredThreads.get(environment);
        final InternalExecutionVertexThreadProfilingData threadProfilingData = environmentThreadSet
          .captureCPUUtilization(environment.getJobID(), this.tmx, timestamp);
        if (threadProfilingData != null) {
          this.profilingDataContainer.addProfilingData(threadProfilingData);
        }
      }
View Full Code Here

    return instanceID;
  }

  public StreamingRuntimeContext createRuntimeContext(String taskName,
      Map<String, OperatorState<?>> states) {
    Environment env = getEnvironment();
    return new StreamingRuntimeContext(taskName, env.getCurrentNumberOfSubtasks(),
        env.getIndexInSubtaskGroup(), getUserCodeClassLoader(), states, env.getCopyTask());
  }
View Full Code Here

    this.userCodeClassLoader = userCodeClassLoader;
   
    if (parent instanceof RegularPactTask) {
      this.udfContext = ((RegularPactTask<?, ?>) parent).createRuntimeContext(taskName);
    } else {
      Environment env = parent.getEnvironment();
      this.udfContext = new DistributedRuntimeUDFContext(taskName, env.getCurrentNumberOfSubtasks(),
          env.getIndexInSubtaskGroup(), userCodeClassLoader, env.getCopyTask());
    }

    setup(parent);
  }
View Full Code Here

    }
  }

  @Override
  public DistributedRuntimeUDFContext createRuntimeContext(String taskName) {
    Environment env = getEnvironment();
    return new IterativeRuntimeUdfContext(taskName, env.getCurrentNumberOfSubtasks(),
        env.getIndexInSubtaskGroup(), getUserCodeClassLoader());
  }
View Full Code Here

    this.output = initOutputs(this, userCodeClassLoader, this.config, this.chainedTasks, this.eventualOutputs);
  }

  public DistributedRuntimeUDFContext createRuntimeContext(String taskName) {
    Environment env = getEnvironment();
    return new DistributedRuntimeUDFContext(taskName, env.getCurrentNumberOfSubtasks(),
        env.getIndexInSubtaskGroup(), getUserCodeClassLoader(), env.getCopyTask());
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.execution.Environment

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.