Tabnine Logo
TaskInfo
Code IndexAdd Tabnine to your IDE (free)

How to use
TaskInfo
in
org.apache.flink.api.common

Best Java code snippets using org.apache.flink.api.common.TaskInfo (Showing top 20 results out of 315)

origin: apache/flink

taskInfo.getMaxNumberOfParallelSubtasks(),
taskInfo.getNumberOfParallelSubtasks(),
taskInfo.getIndexOfThisSubtask());
    operatorIdentifierText,
    keySerializer,
    taskInfo.getMaxNumberOfParallelSubtasks(),
    keyGroupRange,
    environment.getTaskKvStateRegistry(),
origin: apache/flink

@Override
public String getTaskNameWithSubtasks() {
  return taskInfo.getTaskNameWithSubtasks();
}
origin: apache/flink

@Override
public String getTaskName() {
  return taskInfo.getTaskName();
}
origin: apache/flink

operatorID,
operatorClassName,
taskInfo.getIndexOfThisSubtask(),
taskInfo.getNumberOfParallelSubtasks());
origin: apache/flink

private <OUT> List<OUT> executeDataSource(GenericDataSourceBase<?, ?> source, int superStep)
    throws Exception {
  @SuppressWarnings("unchecked")
  GenericDataSourceBase<OUT, ?> typedSource = (GenericDataSourceBase<OUT, ?>) source;
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedSource.getName(), 1, 0, 1, 0);
  
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
  if (RichInputFormat.class.isAssignableFrom(typedSource.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
  } else {
    ctx = null;
  }
  return typedSource.executeOnCollections(ctx, executionConfig);
}

origin: apache/flink

@Override
public int getIndexOfThisSubtask() {
  return taskInfo.getIndexOfThisSubtask();
}
origin: apache/flink

when(mockTaskInfo.getTaskNameWithSubtasks()).thenReturn("foobar");
when(mockTaskInfo.getIndexOfThisSubtask()).thenReturn(0);
Environment mockEnvironment = new MockEnvironmentBuilder().build();
origin: apache/flink

@Override
public int getNumberOfParallelSubtasks() {
  return taskInfo.getNumberOfParallelSubtasks();
}
origin: com.alibaba.blink/flink-runtime

new TaskExecutionStatus(
  currentTask.getExecutionState(),
  currentTask.getTaskInfo().getAttemptNumber(),
  currentTask.getCreateTimestamp(),
  currentTask.getJobVertexId(),
  currentTask.getExecutionId(),
  currentTask.getTaskInfo().getIndexOfThisSubtask(),
  resultPartitionIDs,
  resultPartitionsConsumable,
origin: apache/flink

@Override
public int getMaxNumberOfParallelSubtasks() {
  return taskInfo.getMaxNumberOfParallelSubtasks();
}
origin: apache/flink

@Override
public int getAttemptNumber() {
  return taskInfo.getAttemptNumber();
}
origin: org.apache.flink/flink-runtime

/**
 * Utility function that composes a string for logging purposes. The string includes the given message,
 * the given name of the task and the index in its subtask group as well as the number of instances
 * that exist in its subtask group.
 *
 * @param message The main message for the log.
 * @param taskName The name of the task.
 * @param parent The task that contains the code producing the message.
 *
 * @return The string for logging.
 */
public static String constructLogString(String message, String taskName, AbstractInvokable parent) {
  return message + ":  " + taskName + " (" + (parent.getEnvironment().getTaskInfo().getIndexOfThisSubtask() + 1) +
      '/' + parent.getEnvironment().getTaskInfo().getNumberOfParallelSubtasks() + ')';
}
origin: apache/flink

private <IN, OUT> List<OUT> executeUnaryOperator(SingleInputOperator<?, ?, ?> operator, int superStep) throws Exception {
  Operator<?> inputOp = operator.getInput();
  if (inputOp == null) {
    throw new InvalidProgramException("The unary operation " + operator.getName() + " has no input.");
  }
  
  @SuppressWarnings("unchecked")
  List<IN> inputData = (List<IN>) execute(inputOp, superStep);
  
  @SuppressWarnings("unchecked")
  SingleInputOperator<IN, OUT, ?> typedOp = (SingleInputOperator<IN, OUT, ?>) operator;
  
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedOp.getName(), 1, 0, 1, 0);
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
  if (RichFunction.class.isAssignableFrom(typedOp.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
    
    for (Map.Entry<String, Operator<?>> bcInputs : operator.getBroadcastInputs().entrySet()) {
      List<?> bcData = execute(bcInputs.getValue());
      ctx.setBroadcastVariable(bcInputs.getKey(), bcData);
    }
  } else {
    ctx = null;
  }
  return typedOp.executeOnCollections(inputData, ctx, executionConfig);
}

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: org.apache.flink/flink-core

@Override
public int getNumberOfParallelSubtasks() {
  return taskInfo.getNumberOfParallelSubtasks();
}
origin: org.apache.flink/flink-core

@Override
public int getMaxNumberOfParallelSubtasks() {
  return taskInfo.getMaxNumberOfParallelSubtasks();
}
origin: org.apache.flink/flink-core

@Override
public int getAttemptNumber() {
  return taskInfo.getAttemptNumber();
}
origin: apache/flink

int numKeyGroups = getEnvironment().getTaskInfo().getMaxNumberOfParallelSubtasks();
int numSubtasks = getEnvironment().getTaskInfo().getNumberOfParallelSubtasks();
int subtaskIndex = getEnvironment().getTaskInfo().getIndexOfThisSubtask();
origin: com.alibaba.blink/flink-runtime

/**
 * Utility function that composes a string for logging purposes. The string includes the given message,
 * the given name of the task and the index in its subtask group as well as the number of instances
 * that exist in its subtask group.
 *
 * @param message The main message for the log.
 * @param taskName The name of the task.
 * @param parent The task that contains the code producing the message.
 *
 * @return The string for logging.
 */
public static String constructLogString(String message, String taskName, AbstractInvokable parent) {
  return message + ":  " + taskName + " (" + (parent.getEnvironment().getTaskInfo().getIndexOfThisSubtask() + 1) +
      '/' + parent.getEnvironment().getTaskInfo().getNumberOfParallelSubtasks() + ')';
}
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();
}
org.apache.flink.api.commonTaskInfo

Javadoc

Encapsulates task-specific information: name, index of subtask, parallelism and attempt number.

Most used methods

  • getIndexOfThisSubtask
    Gets the number of this parallel subtask. The numbering starts from 0 and goes up to parallelism-1 (
  • getNumberOfParallelSubtasks
    Gets the parallelism with which the parallel task runs.
  • getTaskNameWithSubtasks
    Returns the name of the task, appended with the subtask indicator, such as "MyTask (3/6)", where 3 w
  • getTaskName
    Returns the name of the task
  • getMaxNumberOfParallelSubtasks
    Gets the max parallelism aka the max number of subtasks.
  • <init>
  • getAttemptNumber
    Gets the attempt number of this parallel subtask. First attempt is numbered 0. The attempt number co
  • getAllocationIDAsString
    Returns the allocation id for where this task is executed.

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • JButton (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now