Skip to content

Create EMR Cluster

Nate Weisz edited this page Oct 6, 2015 · 3 revisions

Provides functionality to start a EMR cluster. If a cluster with same parameters already exist, it will return the existing cluster.

Please note:

  • Optionally, launch parameters will be overridden based on given parameters.
  • To help test the overridden parameters, a dry run mode is provided, where if set, no cluster is created, but the request and the definition are still validated. The overridden definition is returned as part of the response so the user may verify the overridden definition.
  • The dry run validation does not make any calls to AWS. The dry run may be successful, but it may still fail during the call to AWS.

Delegate Class

org.finra.dm.service.activiti.task.CreateEmrCluster

Input Parameters

Name Required Accepted Values Default Value Case Sensitive Description
namespace Y N The name of a valid namespace known by the system.
emrClusterDefinitionName Y N The name of EMR definition. Available definitions are defined EMR Cluster Definition.
emrClusterName Y N The name of EMR cluster.
dryRun N true, false false N When set to true, the request and override will be simulated and the cluster will not be created. This flag should be set to true to test the override parameters.
contentType Y only when emrClusterDefinitionOverride is given xml, json N Indicator whether XML or JSON is provided for emrClusterDefinitionOverride.
emrClusterDefinitionOverride Y only when contentType is given EMR cluster definition XML or JSON. See EMR Cluster Definition. When XML, the root element must exist. No override N/A The parameters to override from the existing definition.

EMR Cluster Definition Override

Please note:

  • If any element is given, the definition parameter will be overridden with the value of the element.
    • ex. If 3.1.0 is given, the AMI version will be overridden to 3.1.0.
  • If an element is given, but is empty, the parameter will be removed.
    • ex. If is given, the AMI version will be removed from the definition parameter.
  • For nested elements, the entire content will be overridden with the given value.
    • If no element is specified, the definition parameter will not be overridden.

Example

<emrClusterDefinition>
    <amiVersion>latest</amiVersion>
</emrClusterDefinition>

Output Parameters

Name Description
{taskId}_emrClusterId Id of the EMR cluster that was created, if a cluster with same applicationName, emrClusterDefinitionName and emrClusterName already exists. returns the existing cluster Id. This field will not be set if the dryRun flag was set to true.
{taskId}_emrClusterStatus Current status of the EMR cluster. This field will not be set if the dryRun flag was set to true.
{taskId}_emrClusterCreated True if EMR cluster was created, false if no cluster was created. Cluster will not be created if it already exists. This flag will always return false if dryRun flag was true.
{taskId}_emrClusterDefinition The cluster definition that was used to create the cluster. This definition will contain the parameters after the override happened. This element will be missing if the cluster was not created for a non-dry run. Dry runs will always return this element.

Sample Usage in Activiti XML

<serviceTask id="createClusterServiceTask" name="Create Cluster" activiti:class="org.finra.dm.service.activiti.task.CreateEmrCluster">
   <extensionElements>
      <activiti:field name="namespace" stringValue="testNamespace"/>
      <activiti:field name="emrClusterDefinitionName" expression="${emrClusterDefinitionName}"/>
      <activiti:field name="emrClusterName" expression="${emrClusterName}"/>
      <activiti:field name="dryRun" expression="${dryRun}"/>
      <activiti:field name="contentType" stringValue="xml"/>
      <activiti:field name="emrClusterDefinitionOverride" expression="${emrClusterDefinitionOverride}"/>
   </extensionElements>
</serviceTask>
Clone this wiki locally