Search in sources :

Example 11 with EmrShellStepAddRequest

use of org.finra.herd.model.api.xml.EmrShellStepAddRequest in project herd by FINRAOS.

the class EmrServiceTest method getNewEmrShellStepAddRequest.

/**
 * This method creates a EMR Shell step add request. This is called from all the other test methods.
 */
private EmrShellStepAddRequest getNewEmrShellStepAddRequest(String clusterName) throws Exception {
    // Create the request.
    EmrShellStepAddRequest request = new EmrShellStepAddRequest();
    // Fill in the parameters.
    request.setNamespace(NAMESPACE);
    request.setEmrClusterDefinitionName(EMR_CLUSTER_DEFINITION_NAME);
    request.setEmrClusterName(clusterName);
    request.setStepName("A_SHELL_STEP");
    request.setScriptLocation("SCRIPT_LOCATION");
    request.setContinueOnError(false);
    List<String> arguments = new ArrayList<>();
    arguments.add("one");
    arguments.add("two");
    request.setScriptArguments(arguments);
    return request;
}
Also used : EmrShellStepAddRequest(org.finra.herd.model.api.xml.EmrShellStepAddRequest) ArrayList(java.util.ArrayList)

Example 12 with EmrShellStepAddRequest

use of org.finra.herd.model.api.xml.EmrShellStepAddRequest in project herd by FINRAOS.

the class EmrServiceTest method testEmrAddStepsAmazonOtherException.

/**
 * This method tests the Amazon exceptions
 */
@Test(expected = AmazonServiceException.class)
public void testEmrAddStepsAmazonOtherException() throws Exception {
    // Create the namespace entity.
    NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()));
    EmrClusterCreateRequest request = getNewEmrClusterCreateRequest();
    emrService.createCluster(request);
    // Create a new EMR cluster create request.
    EmrShellStepAddRequest stepRequest = getNewEmrShellStepAddRequest(request.getEmrClusterName());
    stepRequest.setStepName(MockAwsOperationsHelper.AMAZON_SERVICE_EXCEPTION);
    emrService.addStepToCluster(stepRequest);
}
Also used : NamespaceEntity(org.finra.herd.model.jpa.NamespaceEntity) EmrClusterCreateRequest(org.finra.herd.model.api.xml.EmrClusterCreateRequest) EmrShellStepAddRequest(org.finra.herd.model.api.xml.EmrShellStepAddRequest) Test(org.junit.Test)

Example 13 with EmrShellStepAddRequest

use of org.finra.herd.model.api.xml.EmrShellStepAddRequest in project herd by FINRAOS.

the class EmrShellStepHelper method validateAddStepRequest.

@Override
public void validateAddStepRequest(Object step) {
    EmrShellStepAddRequest shellStep = (EmrShellStepAddRequest) step;
    validateStepName(shellStep.getStepName());
    validateScriptLocation(shellStep.getScriptLocation());
}
Also used : EmrShellStepAddRequest(org.finra.herd.model.api.xml.EmrShellStepAddRequest)

Example 14 with EmrShellStepAddRequest

use of org.finra.herd.model.api.xml.EmrShellStepAddRequest in project herd by FINRAOS.

the class AddEmrShellStep method executeImpl.

@Override
public void executeImpl(DelegateExecution execution) throws Exception {
    // Create the request.
    EmrShellStepAddRequest request = new EmrShellStepAddRequest();
    populateCommonParams(request, execution);
    request.setScriptLocation(getScriptLocation(execution));
    request.setScriptArguments(getScriptArguments(execution));
    addEmrStepAndSetWorkflowVariables(request, execution);
}
Also used : EmrShellStepAddRequest(org.finra.herd.model.api.xml.EmrShellStepAddRequest)

Aggregations

EmrShellStepAddRequest (org.finra.herd.model.api.xml.EmrShellStepAddRequest)14 Test (org.junit.Test)10 EmrClusterCreateRequest (org.finra.herd.model.api.xml.EmrClusterCreateRequest)9 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)8 ArrayList (java.util.ArrayList)4 EmrShellStep (org.finra.herd.model.api.xml.EmrShellStep)4 Method (java.lang.reflect.Method)2 EmrHadoopJarStepAddRequest (org.finra.herd.model.api.xml.EmrHadoopJarStepAddRequest)2 EmrHiveStepAddRequest (org.finra.herd.model.api.xml.EmrHiveStepAddRequest)2 EmrPigStepAddRequest (org.finra.herd.model.api.xml.EmrPigStepAddRequest)2 EmrClusterAlternateKeyDto (org.finra.herd.model.dto.EmrClusterAlternateKeyDto)2 EmrStepHelper (org.finra.herd.service.helper.EmrStepHelper)2 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1 EmrCluster (org.finra.herd.model.api.xml.EmrCluster)1 EmrMasterSecurityGroupAddRequest (org.finra.herd.model.api.xml.EmrMasterSecurityGroupAddRequest)1