The process of TezChild execute a task

The process of TezChild execute a task,第1张

The process of TezChild execute a task TezChild.run

TezChild get a task from containerReporter

ListenableFuture getTaskFuture = executor.submit(containerReporter);
containerTask = getTaskFuture.get();
ContainerReporter.callInternal

umbilical is umbilical to App Master.

@Override
  protected ContainerTask callInternal() throws Exception {
     containerTask = umbilical.getTask(containerContext);
TezChild.run

After retrieve a ContainerTask object, create a TezTaskRunner2 object and call run method of it.

 TezTaskRunner2 taskRunner = new TezTaskRunner2(defaultConf, childUGI,
            localDirs, containerTask.getTaskSpec(), appAttemptNumber,
            serviceConsumermetadata, serviceProviderEnvMap, startedInputsMap, taskReporter,
            executor, objectRegistry, pid, executionContext, memAvailable, updateSysCounters,
            hadoopShim, sharedExecutor);
TezTaskRunner2. constructor

create task.

 this.task = new LogicalIOProcessorRuntimetask(taskSpec, appAttemptNumber, taskConf, localDirs,
        umbilicalAndErrorHandler, serviceConsumermetadata, serviceProviderEnvMap, startedInputsMap,
        objectRegistry, pid, executionContext, memAvailable, updateSysCounters, hadoopShim,
        sharedExecutor == null ? localExecutor : sharedExecutor);

TezTaskRunner2. run
create a TaskRunner2Callable object and execute it in a thread.

public TaskRunner2Result run() {
      taskRunnerCallable = new TaskRunner2Callable(task, ugi,
          umbilicalAndErrorHandler);
      future = executor.submit(taskRunnerCallable);
      future.get();
TaskRunner2Callable

extends CallableWithNdc, and CallableWithNdc.call calls callInteranl, so finally callInternal() in TaskRunner2Callable is called.

public class TaskRunner2Callable extends CallableWithNdc

CallableWithNdc.call

 @Override
  public final T call() throws Exception {
    NDC.inherit(ndcStack);
    try {
      return callInternal();
    } finally {
      NDC.clear();
    }
  }
TaskRunner2Callable.callInternal

The type of task is LogicalIOProcessorRuntimetask

@Override
          task.initialize();
          task.run();
          task.close();
          task.cleanup();
    }
  }
LogicalIOProcessorRuntimetask constructor

define processorDescriptor in constructor

this.processorDescriptor = taskSpec.getProcessorDescriptor();
LogicalIOProcessorRuntimetask.initialize

The type of processor is AbstractLogicalIOProcessor. In case of Hive the class name is org.apache.hadoop.hive.ql.exec.tez.TezProcessor.

this.processor = createProcessor(processorDescriptor.getClassName(), processorContext);
run
public void run() throws Exception {
    Preconditions.checkState(this.state.get() == State.INITED,
        "Can only run while in INITED state. Current: " + this.state);
    this.state.set(State.RUNNING);
    processor.run(runInputMap, runOutputMap);
  }
close
public void close() throws Exception {
    processor.close();
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5687952.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存