Search in sources :

Example 1 with DataprocRuntimeJobManager

use of io.cdap.cdap.runtime.spi.runtimejob.DataprocRuntimeJobManager in project cdap by caskdata.

the class AbstractDataprocProvisioner method getRuntimeJobManager.

/**
 * Provides implementation of {@link RuntimeJobManager}.
 */
@Override
public Optional<RuntimeJobManager> getRuntimeJobManager(ProvisionerContext context) {
    Map<String, String> properties = createContextProperties(context);
    DataprocConf conf = DataprocConf.create(properties);
    // runtime job manager for job launch.
    if (!conf.isRuntimeJobManagerEnabled()) {
        return Optional.empty();
    }
    try {
        String clusterName = getClusterName(context);
        String projectId = conf.getProjectId();
        String region = conf.getRegion();
        String bucket = properties.get(BUCKET);
        Map<String, String> systemLabels = getSystemLabels();
        return Optional.of(new DataprocRuntimeJobManager(new DataprocClusterInfo(context, clusterName, conf.getDataprocCredentials(), getRootUrl(conf), projectId, region, bucket, systemLabels)));
    } catch (Exception e) {
        throw new RuntimeException("Error while getting credentials for dataproc. ", e);
    }
}
Also used : DataprocRuntimeJobManager(io.cdap.cdap.runtime.spi.runtimejob.DataprocRuntimeJobManager) DataprocClusterInfo(io.cdap.cdap.runtime.spi.runtimejob.DataprocClusterInfo) GeneralSecurityException(java.security.GeneralSecurityException) IOException(java.io.IOException)

Aggregations

DataprocClusterInfo (io.cdap.cdap.runtime.spi.runtimejob.DataprocClusterInfo)1 DataprocRuntimeJobManager (io.cdap.cdap.runtime.spi.runtimejob.DataprocRuntimeJobManager)1 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1