Search in sources :

Example 1 with TezAMPolicyProvider

use of org.apache.tez.dag.app.security.authorize.TezAMPolicyProvider in project tez by apache.

the class TezTaskCommunicatorImpl method startRpcServer.

protected void startRpcServer() {
    try {
        JobTokenSecretManager jobTokenSecretManager = new JobTokenSecretManager();
        jobTokenSecretManager.addTokenForJob(tokenIdentifier, sessionToken);
        server = new RPC.Builder(conf).setProtocol(TezTaskUmbilicalProtocol.class).setBindAddress("0.0.0.0").setPort(0).setInstance(taskUmbilical).setNumHandlers(conf.getInt(TezConfiguration.TEZ_AM_TASK_LISTENER_THREAD_COUNT, TezConfiguration.TEZ_AM_TASK_LISTENER_THREAD_COUNT_DEFAULT)).setPortRangeConfig(TezConfiguration.TEZ_AM_TASK_AM_PORT_RANGE).setSecretManager(jobTokenSecretManager).build();
        // Enable service authorization?
        if (conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
            refreshServiceAcls(conf, new TezAMPolicyProvider());
        }
        server.start();
        InetSocketAddress serverBindAddress = NetUtils.getConnectAddress(server);
        this.address = NetUtils.createSocketAddrForHost(serverBindAddress.getAddress().getCanonicalHostName(), serverBindAddress.getPort());
        LOG.info("Instantiated TezTaskCommunicator RPC at " + this.address);
    } catch (IOException e) {
        throw new TezUncheckedException(e);
    }
}
Also used : RPC(org.apache.hadoop.ipc.RPC) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) TezAMPolicyProvider(org.apache.tez.dag.app.security.authorize.TezAMPolicyProvider) JobTokenSecretManager(org.apache.tez.common.security.JobTokenSecretManager) InetSocketAddress(java.net.InetSocketAddress) IOException(java.io.IOException)

Example 2 with TezAMPolicyProvider

use of org.apache.tez.dag.app.security.authorize.TezAMPolicyProvider in project tez by apache.

the class DAGClientServer method serviceStart.

@Override
public void serviceStart() {
    try {
        Configuration conf = getConfig();
        InetSocketAddress addr = new InetSocketAddress(0);
        DAGClientAMProtocolBlockingPBServerImpl service = new DAGClientAMProtocolBlockingPBServerImpl(realInstance, stagingFs);
        BlockingService blockingService = DAGClientAMProtocol.newReflectiveBlockingService(service);
        int numHandlers = conf.getInt(TezConfiguration.TEZ_AM_CLIENT_THREAD_COUNT, TezConfiguration.TEZ_AM_CLIENT_THREAD_COUNT_DEFAULT);
        if (numHandlers < 2) {
            numHandlers = 2;
        }
        server = createServer(DAGClientAMProtocolBlockingPB.class, addr, conf, numHandlers, blockingService, TezConfiguration.TEZ_AM_CLIENT_AM_PORT_RANGE);
        // Enable service authorization?
        if (conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
            refreshServiceAcls(conf, new TezAMPolicyProvider());
        }
        server.start();
        InetSocketAddress serverBindAddress = NetUtils.getConnectAddress(server);
        this.bindAddress = NetUtils.createSocketAddrForHost(serverBindAddress.getAddress().getCanonicalHostName(), serverBindAddress.getPort());
        LOG.info("Instantiated DAGClientRPCServer at " + bindAddress);
    } catch (Exception e) {
        LOG.error("Failed to start DAGClientServer: ", e);
        throw new TezUncheckedException(e);
    }
}
Also used : DAGClientAMProtocolBlockingPB(org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB) Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) TezAMPolicyProvider(org.apache.tez.dag.app.security.authorize.TezAMPolicyProvider) InetSocketAddress(java.net.InetSocketAddress) BlockingService(com.google.protobuf.BlockingService) DAGClientAMProtocolBlockingPBServerImpl(org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPBServerImpl) IOException(java.io.IOException) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException)

Aggregations

IOException (java.io.IOException)2 InetSocketAddress (java.net.InetSocketAddress)2 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)2 TezAMPolicyProvider (org.apache.tez.dag.app.security.authorize.TezAMPolicyProvider)2 BlockingService (com.google.protobuf.BlockingService)1 Configuration (org.apache.hadoop.conf.Configuration)1 RPC (org.apache.hadoop.ipc.RPC)1 JobTokenSecretManager (org.apache.tez.common.security.JobTokenSecretManager)1 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)1 DAGClientAMProtocolBlockingPB (org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB)1 DAGClientAMProtocolBlockingPBServerImpl (org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPBServerImpl)1