org.apache.flink.runtime.execution.Environment.getTaskInfo()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中org.apache.flink.runtime.execution.Environment.getTaskInfo()方法的一些代码示例,展示了Environment.getTaskInfo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getTaskInfo()方法的具体详情如下:
包路径:org.apache.flink.runtime.execution.Environment
类名称:Environment
方法名:getTaskInfo

Environment.getTaskInfo介绍

[英]Returns the TaskInfo object associated with this subtask
[中]返回与此子任务关联的TaskInfo对象

代码示例

代码示例来源:origin: apache/flink

/**
 * Gets the name of the task, in the form "taskname (2/5)".
 * @return The name of the task.
 */
public String getName() {
  return getEnvironment().getTaskInfo().getTaskNameWithSubtasks();
}

代码示例来源:origin: apache/flink

@VisibleForTesting
public static <OUT> List<RecordWriter<SerializationDelegate<StreamRecord<OUT>>>> createRecordWriters(
    StreamConfig configuration,
    Environment environment) {
  List<RecordWriter<SerializationDelegate<StreamRecord<OUT>>>> recordWriters = new ArrayList<>();
  List<StreamEdge> outEdgesInOrder = configuration.getOutEdgesInOrder(environment.getUserClassLoader());
  Map<Integer, StreamConfig> chainedConfigs = configuration.getTransitiveChainedTaskConfigsWithSelf(environment.getUserClassLoader());
  for (int i = 0; i < outEdgesInOrder.size(); i++) {
    StreamEdge edge = outEdgesInOrder.get(i);
    recordWriters.add(
      createRecordWriter(
        edge,
        i,
        environment,
        environment.getTaskInfo().getTaskName(),
        chainedConfigs.get(edge.getSourceId()).getBufferTimeout()));
  }
  return recordWriters;
}

代码示例来源:origin: apache/flink

@Override
public void init() throws Exception {
  final String iterationId = getConfiguration().getIterationId();
  if (iterationId == null || iterationId.length() == 0) {
    throw new Exception("Missing iteration ID in the task configuration");
  }
  final String brokerID = StreamIterationHead.createBrokerIdString(getEnvironment().getJobID(), iterationId,
      getEnvironment().getTaskInfo().getIndexOfThisSubtask());
  final long iterationWaitTime = getConfiguration().getIterationWaitTime();
  LOG.info("Iteration tail {} trying to acquire feedback queue under {}", getName(), brokerID);
  @SuppressWarnings("unchecked")
  BlockingQueue<StreamRecord<IN>> dataChannel =
      (BlockingQueue<StreamRecord<IN>>) BlockingQueueBroker.INSTANCE.get(brokerID);
  LOG.info("Iteration tail {} acquired feedback queue {}", getName(), brokerID);
  this.headOperator = new RecordPusher<>();
  this.headOperator.setup(this, getConfiguration(), new IterationTailOutput<>(dataChannel, iterationWaitTime));
  // call super.init() last because that needs this.headOperator to be set up
  super.init();
}

代码示例来源:origin: apache/flink

@Nonnull MetricGroup metricGroup) throws Exception {
TaskInfo taskInfo = environment.getTaskInfo();
OperatorSubtaskDescriptionText operatorSubtaskDescription =
  new OperatorSubtaskDescriptionText(

代码示例来源:origin: apache/flink

public StreamingRuntimeContext(AbstractStreamOperator<?> operator,
                Environment env, Map<String, Accumulator<?, ?>> accumulators) {
  super(env.getTaskInfo(),
      env.getUserClassLoader(),
      operator.getExecutionConfig(),
      accumulators,
      env.getDistributedCacheEntries(),
      operator.getMetricGroup());
  this.operator = operator;
  this.taskEnvironment = env;
  this.streamConfig = new StreamConfig(env.getTaskConfiguration());
  this.operatorUniqueID = operator.getOperatorID().toString();
}

代码示例来源:origin: apache/flink

getEnvironment().getTaskInfo().getIndexOfThisSubtask());

代码示例来源:origin: apache/flink

TaskInfo taskInfo = environment.getTaskInfo();

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

/**
 * Returns the current number of subtasks the respective task is split into.
 * 
 * @return the current number of subtasks the respective task is split into
 */
public int getCurrentNumberOfSubtasks() {
  return this.environment.getTaskInfo().getNumberOfParallelSubtasks();
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

/**
 * Returns the index of this subtask in the subtask group.
 * 
 * @return the index of this subtask in the subtask group
 */
public int getIndexInSubtaskGroup() {
  return this.environment.getTaskInfo().getIndexOfThisSubtask();
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Gets the name of the task, in the form "taskname (2/5)".
 * @return The name of the task.
 */
public String getName() {
  return getEnvironment().getTaskInfo().getTaskNameWithSubtasks();
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Gets the name of the task, in the form "taskname (2/5)".
 * @return The name of the task.
 */
public String getName() {
  return getEnvironment().getTaskInfo().getTaskNameWithSubtasks();
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

/**
 * Utility function that composes a string for logging purposes. The string includes the given message and
 * the index of the task in its task group together with the number of tasks in the task group.
 *
 * @param message The main message for the log.
 * @return The string ready for logging.
 */
private String getLogString(String message) {
  return BatchTask.constructLogString(message, this.getEnvironment().getTaskInfo().getTaskName(), this);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

/**
 * Utility function that composes a string for logging purposes. The string includes the given message and
 * the index of the task in its task group together with the number of tasks in the task group.
 * 
 * @param message The main message for the log.
 * @return The string ready for logging.
 */
private String getLogString(String message) {
  return BatchTask.constructLogString(message, this.getEnvironment().getTaskInfo().getTaskName(), this);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

public DistributedRuntimeUDFContext createRuntimeContext() {
    Environment env = getEnvironment();

    String sourceName =  getEnvironment().getTaskInfo().getTaskName().split("->")[0].trim();
    sourceName = sourceName.startsWith("CHAIN") ? sourceName.substring(6) : sourceName;
    return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
        getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), 
        getEnvironment().getMetricGroup().addOperator(sourceName));
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

public DistributedRuntimeUDFContext createRuntimeContext() {
    Environment env = getEnvironment();

    String sourceName =  getEnvironment().getTaskInfo().getTaskName().split("->")[0].trim();
    sourceName = sourceName.startsWith("CHAIN") ? sourceName.substring(6) : sourceName;
    return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
        getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), 
        getEnvironment().getMetricGroup().getOrAddOperator(sourceName));
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
  Environment env = getEnvironment();
  return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
      getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics);
}

代码示例来源:origin: org.apache.flink/flink-runtime

public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
  Environment env = getEnvironment();
  return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
      getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics);
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) {
  Environment env = getEnvironment();
  return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
      getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorRegistry, metrics);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

public DistributedRuntimeUDFContext createRuntimeContext() {
    Environment env = getEnvironment();

    return new DistributedRuntimeUDFContext(env.getTaskInfo(), getUserCodeClassLoader(),
        getExecutionConfig(), env.getDistributedCacheEntries(), env.getAccumulatorRegistry().getUserMap(), 
        getEnvironment().getMetricGroup().addOperator(getEnvironment().getTaskInfo().getTaskName()));
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

public String brokerKey() {
  if (brokerKey == null) {
    int iterationId = config.getIterationId();
    brokerKey = getEnvironment().getJobID().toString() + '#' + iterationId + '#' +
        getEnvironment().getTaskInfo().getIndexOfThisSubtask();
  }
  return brokerKey;
}

相关文章