Search in sources :

Example 1 with LivyRestClient

use of com.thinkbiganalytics.kylo.spark.client.jersey.LivyRestClient in project kylo by Teradata.

the class SparkLivyConfig method livyHeartbeatMonitor.

@Bean
public LivyHeartbeatMonitor livyHeartbeatMonitor() {
    // LivyHeartbeatMonitor gets it's own jersey client
    LivyProperties livyProperties = livyProperties();
    final JerseyClientConfig config = new JerseyClientConfig();
    config.setHost(livyProperties.getHostname());
    config.setPort(livyProperties.getPort());
    if (livyProperties().getTruststorePassword() != null) {
        config.setHttps(true);
        config.setTruststorePath(livyProperties.getTruststorePath());
        config.setTruststorePassword(livyProperties.getTruststorePassword());
        config.setTrustStoreType(livyProperties.getTruststoreType());
    }
    // end if
    // all clients will have kerberos
    LivyRestClient.setKerberosSparkProperties(kerberosSparkProperties());
    JerseyRestClient livyRestClient = new LivyRestClient(config);
    return new LivyHeartbeatMonitor(livyClient(), livyRestClient, livyServer(livyProperties()), livyProperties());
}
Also used : SparkLivyRestClient(com.thinkbiganalytics.kylo.spark.livy.SparkLivyRestClient) LivyRestClient(com.thinkbiganalytics.kylo.spark.client.jersey.LivyRestClient) JerseyClientConfig(com.thinkbiganalytics.rest.JerseyClientConfig) LivyHeartbeatMonitor(com.thinkbiganalytics.kylo.spark.client.livy.LivyHeartbeatMonitor) JerseyRestClient(com.thinkbiganalytics.rest.JerseyRestClient) Bean(org.springframework.context.annotation.Bean)

Example 2 with LivyRestClient

use of com.thinkbiganalytics.kylo.spark.client.jersey.LivyRestClient in project kylo by Teradata.

the class SparkLivyProcessManager method getClient.

/**
 * Gets or creates a Jersey REST client for the specified Spark Shell process.
 *
 * @param process the Spark Shell process
 * @return the Jersey REST client
 */
@Nonnull
JerseyRestClient getClient(@Nonnull final SparkShellProcess process) {
    return clients.computeIfAbsent(process, target -> {
        final JerseyClientConfig config = new JerseyClientConfig();
        config.setHost(target.getHostname());
        config.setPort(target.getPort());
        if (livyProperties.getTruststorePassword() != null) {
            config.setHttps(true);
            config.setTruststorePath(livyProperties.getTruststorePath());
            config.setTruststorePassword(livyProperties.getTruststorePassword());
            config.setTrustStoreType(livyProperties.getTruststoreType());
        }
        // end if
        // TODO: we don't need a Spring bean of the rest client if we are doing this ...
        // all clients will have kerberos
        LivyRestClient.setKerberosSparkProperties(kerberosSparkProperties);
        return new LivyRestClient(config);
    });
}
Also used : LivyRestClient(com.thinkbiganalytics.kylo.spark.client.jersey.LivyRestClient) JerseyClientConfig(com.thinkbiganalytics.rest.JerseyClientConfig) Nonnull(javax.annotation.Nonnull)

Aggregations

LivyRestClient (com.thinkbiganalytics.kylo.spark.client.jersey.LivyRestClient)2 JerseyClientConfig (com.thinkbiganalytics.rest.JerseyClientConfig)2 LivyHeartbeatMonitor (com.thinkbiganalytics.kylo.spark.client.livy.LivyHeartbeatMonitor)1 SparkLivyRestClient (com.thinkbiganalytics.kylo.spark.livy.SparkLivyRestClient)1 JerseyRestClient (com.thinkbiganalytics.rest.JerseyRestClient)1 Nonnull (javax.annotation.Nonnull)1 Bean (org.springframework.context.annotation.Bean)1