Search in sources :

Example 1 with TezRootInputInitializerContextImpl

use of org.apache.tez.dag.app.dag.impl.TezRootInputInitializerContextImpl in project tez by apache.

the class RootInputInitializerManager method runInputInitializers.

public void runInputInitializers(List<RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>> inputs) throws TezException {
    for (RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor> input : inputs) {
        InputInitializerContext context = new TezRootInputInitializerContextImpl(input, vertex, appContext, this);
        InputInitializer initializer;
        try {
            TezUtilsInternal.setHadoopCallerContext(appContext.getHadoopShim(), vertex.getVertexId());
            initializer = createInitializer(input, context);
        } finally {
            appContext.getHadoopShim().clearHadoopCallerContext();
        }
        InitializerWrapper initializerWrapper = new InitializerWrapper(input, initializer, context, vertex, entityStateTracker, appContext);
        // Register pending vertex update registrations
        List<VertexUpdateRegistrationHolder> vertexUpdateRegistrations = pendingVertexRegistrations.removeAll(input.getName());
        if (vertexUpdateRegistrations != null) {
            for (VertexUpdateRegistrationHolder h : vertexUpdateRegistrations) {
                initializerWrapper.registerForVertexStateUpdates(h.vertexName, h.stateSet);
            }
        }
        initializerMap.put(input.getName(), initializerWrapper);
        ListenableFuture<List<Event>> future = executor.submit(new InputInitializerCallable(initializerWrapper, dagUgi, appContext));
        Futures.addCallback(future, createInputInitializerCallback(initializerWrapper));
    }
}
Also used : InputDescriptor(org.apache.tez.dag.api.InputDescriptor) InputInitializerDescriptor(org.apache.tez.dag.api.InputInitializerDescriptor) InputInitializer(org.apache.tez.runtime.api.InputInitializer) List(java.util.List) LinkedList(java.util.LinkedList) InputInitializerContext(org.apache.tez.runtime.api.InputInitializerContext) TezRootInputInitializerContextImpl(org.apache.tez.dag.app.dag.impl.TezRootInputInitializerContextImpl)

Aggregations

LinkedList (java.util.LinkedList)1 List (java.util.List)1 InputDescriptor (org.apache.tez.dag.api.InputDescriptor)1 InputInitializerDescriptor (org.apache.tez.dag.api.InputInitializerDescriptor)1 TezRootInputInitializerContextImpl (org.apache.tez.dag.app.dag.impl.TezRootInputInitializerContextImpl)1 InputInitializer (org.apache.tez.runtime.api.InputInitializer)1 InputInitializerContext (org.apache.tez.runtime.api.InputInitializerContext)1