Example usage for com.amazonaws.services.elasticmapreduce.model InstanceGroupType MASTER

List of usage examples for com.amazonaws.services.elasticmapreduce.model InstanceGroupType MASTER

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticmapreduce.model InstanceGroupType MASTER.

Prototype

InstanceGroupType MASTER

To view the source code for com.amazonaws.services.elasticmapreduce.model InstanceGroupType MASTER.

Click Source Link

Usage

From source file:org.finra.dm.dao.impl.EmrDaoImpl.java

License:Apache License

/**
 * Add Security groups to the master node of EMR cluster.
 *
 * @param clusterName EMR cluster name./*from www .  j a  va2 s . c  om*/
 * @param securityGroups the security groups list.
 * @param awsParams the proxy details.
 *
 * @return the security groups that were added.
 */
@Override
public List<String> addEmrMasterSecurityGroups(String clusterName, List<String> securityGroups,
        AwsParamsDto awsParams) throws Exception {
    // Look up cluster
    String clusterId = getValidEmrClusterIdByName(clusterName, awsParams);

    // Get the master EC2 instance
    ListInstancesRequest listInstancesRequest = new ListInstancesRequest().withClusterId(clusterId)
            .withInstanceGroupTypes(InstanceGroupType.MASTER);

    List<Instance> instances = emrOperations
            .listClusterInstancesRequest(getEmrClient(awsParams), listInstancesRequest).getInstances();

    // Throw error in case there are no master instances found yet
    if (instances.size() == 0) {
        throw new IllegalArgumentException(
                "No master instances found for the cluster \"" + clusterName + "\".");
    }

    for (Instance instance : instances) {
        ec2Dao.addSecurityGroupsToEc2Instance(instance.getEc2InstanceId(), securityGroups, awsParams);
    }

    return securityGroups;
}

From source file:org.finra.dm.dao.impl.EmrDaoImpl.java

License:Apache License

/**
 * Gets the master instance of the EMR cluster.
 *
 * @param clusterId EMR cluster id.//from w ww . j ava2  s  .com
 * @param awsParams the proxy details.
 *
 * @return the master instance of the cluster.
 */
@Override
public Instance getEmrMasterInstance(String clusterId, AwsParamsDto awsParams) throws Exception {
    // Get the master EC2 instance
    ListInstancesRequest listInstancesRequest = new ListInstancesRequest().withClusterId(clusterId)
            .withInstanceGroupTypes(InstanceGroupType.MASTER);

    List<Instance> instances = emrOperations
            .listClusterInstancesRequest(getEmrClient(awsParams), listInstancesRequest).getInstances();

    // Throw error in case there are no master instances found yet
    if (instances.size() == 0) {
        throw new IllegalArgumentException("No master instances found for the cluster \"" + clusterId + "\".");
    }

    // EMR has only one master node.
    return instances.get(0);
}

From source file:org.finra.herd.dao.impl.EmrDaoImpl.java

License:Apache License

@Override
public List<String> addEmrMasterSecurityGroups(String clusterId, List<String> securityGroups,
        AwsParamsDto awsParams) throws Exception {
    // Get the master EC2 instance
    ListInstancesRequest listInstancesRequest = new ListInstancesRequest().withClusterId(clusterId)
            .withInstanceGroupTypes(InstanceGroupType.MASTER);

    List<Instance> instances = emrOperations
            .listClusterInstancesRequest(getEmrClient(awsParams), listInstancesRequest).getInstances();

    // Throw error in case there are no master instances found yet
    if (instances.size() == 0) {
        throw new IllegalArgumentException("No master instances found for the cluster \"" + clusterId + "\".");
    }/*from   w  w  w .  j a v a  2  s.  c om*/

    for (Instance instance : instances) {
        ec2Dao.addSecurityGroupsToEc2Instance(instance.getEc2InstanceId(), securityGroups, awsParams);
    }

    return securityGroups;
}

From source file:org.finra.herd.dao.impl.EmrDaoImpl.java

License:Apache License

@Override
public Instance getEmrMasterInstance(String clusterId, AwsParamsDto awsParams) throws Exception {
    // Get the master EC2 instance
    ListInstancesRequest listInstancesRequest = new ListInstancesRequest().withClusterId(clusterId)
            .withInstanceGroupTypes(InstanceGroupType.MASTER);

    List<Instance> instances = emrOperations
            .listClusterInstancesRequest(getEmrClient(awsParams), listInstancesRequest).getInstances();

    // Throw error in case there are no master instances found yet
    if (instances.size() == 0) {
        throw new IllegalArgumentException("No master instances found for the cluster \"" + clusterId + "\".");
    }/*w w w. j  a v a 2  s. c  om*/

    // EMR has only one master node.
    return instances.get(0);
}