Class: Aws::EMR::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::EMR::Client
- Includes:
- ClientStubs
- Defined in:
- lib/aws-sdk-emr/client.rb
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#add_instance_fleet(params = {}) ⇒ Types::AddInstanceFleetOutput
Adds an instance fleet to a running cluster.
-
#add_instance_groups(params = {}) ⇒ Types::AddInstanceGroupsOutput
Adds one or more instance groups to a running cluster.
-
#add_job_flow_steps(params = {}) ⇒ Types::AddJobFlowStepsOutput
AddJobFlowSteps adds new steps to a running cluster.
-
#add_tags(params = {}) ⇒ Struct
Adds tags to an Amazon EMR resource.
-
#cancel_steps(params = {}) ⇒ Types::CancelStepsOutput
Cancels a pending step or steps in a running cluster.
-
#create_security_configuration(params = {}) ⇒ Types::CreateSecurityConfigurationOutput
Creates a security configuration, which is stored in the service and can be specified when a cluster is created.
-
#delete_security_configuration(params = {}) ⇒ Struct
Deletes a security configuration.
-
#describe_cluster(params = {}) ⇒ Types::DescribeClusterOutput
Provides cluster-level details including status, hardware and software configuration, VPC settings, and so on.
-
#describe_job_flows(params = {}) ⇒ Types::DescribeJobFlowsOutput
This API is deprecated and will eventually be removed.
-
#describe_security_configuration(params = {}) ⇒ Types::DescribeSecurityConfigurationOutput
Provides the details of a security configuration by returning the configuration JSON.
-
#describe_step(params = {}) ⇒ Types::DescribeStepOutput
Provides more detail about the cluster step.
-
#list_bootstrap_actions(params = {}) ⇒ Types::ListBootstrapActionsOutput
Provides information about the bootstrap actions associated with a cluster.
-
#list_clusters(params = {}) ⇒ Types::ListClustersOutput
Provides the status of all clusters visible to this AWS account.
-
#list_instance_fleets(params = {}) ⇒ Types::ListInstanceFleetsOutput
Lists all available details about the instance fleets in a cluster.
-
#list_instance_groups(params = {}) ⇒ Types::ListInstanceGroupsOutput
Provides all available details about the instance groups in a cluster.
-
#list_instances(params = {}) ⇒ Types::ListInstancesOutput
Provides information for all active EC2 instances and EC2 instances terminated in the last 30 days, up to a maximum of 2,000.
-
#list_security_configurations(params = {}) ⇒ Types::ListSecurityConfigurationsOutput
Lists all the security configurations visible to this account, providing their creation dates and times, and their names.
-
#list_steps(params = {}) ⇒ Types::ListStepsOutput
Provides a list of steps for the cluster in reverse order unless you specify stepIds with the request.
-
#modify_instance_fleet(params = {}) ⇒ Struct
Modifies the target On-Demand and target Spot capacities for the instance fleet with the specified InstanceFleetID within the cluster specified using ClusterID.
-
#modify_instance_groups(params = {}) ⇒ Struct
ModifyInstanceGroups modifies the number of nodes and configuration settings of an instance group.
-
#put_auto_scaling_policy(params = {}) ⇒ Types::PutAutoScalingPolicyOutput
Creates or updates an automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster.
-
#remove_auto_scaling_policy(params = {}) ⇒ Struct
Removes an automatic scaling policy from a specified instance group within an EMR cluster.
-
#remove_tags(params = {}) ⇒ Struct
Removes tags from an Amazon EMR resource.
-
#run_job_flow(params = {}) ⇒ Types::RunJobFlowOutput
RunJobFlow creates and starts running a new cluster (job flow).
-
#set_termination_protection(params = {}) ⇒ Struct
SetTerminationProtection locks a cluster (job flow) so the EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error.
-
#set_visible_to_all_users(params = {}) ⇒ Struct
Sets whether all AWS Identity and Access Management (IAM) users under your account can access the specified clusters (job flows).
-
#terminate_job_flows(params = {}) ⇒ Struct
TerminateJobFlows shuts a list of clusters (job flows) down.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
185 186 187 |
# File 'lib/aws-sdk-emr/client.rb', line 185 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2325 2326 2327 |
# File 'lib/aws-sdk-emr/client.rb', line 2325 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2328 2329 2330 |
# File 'lib/aws-sdk-emr/client.rb', line 2328 def errors_module Errors end |
Instance Method Details
#add_instance_fleet(params = {}) ⇒ Types::AddInstanceFleetOutput
Adds an instance fleet to a running cluster.
<note markdown=“1”> The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x.
</note>
269 270 271 272 |
# File 'lib/aws-sdk-emr/client.rb', line 269 def add_instance_fleet(params = {}, = {}) req = build_request(:add_instance_fleet, params) req.send_request() end |
#add_instance_groups(params = {}) ⇒ Types::AddInstanceGroupsOutput
Adds one or more instance groups to a running cluster.
375 376 377 378 |
# File 'lib/aws-sdk-emr/client.rb', line 375 def add_instance_groups(params = {}, = {}) req = build_request(:add_instance_groups, params) req.send_request() end |
#add_job_flow_steps(params = {}) ⇒ Types::AddJobFlowStepsOutput
AddJobFlowSteps adds new steps to a running cluster. A maximum of 256 steps are allowed in each job flow.
If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using SSH to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop. For more information on how to do this, see [Add More than 256 Steps to a Cluster] in the *Amazon EMR Management Guide*.
A step specifies the location of a JAR file stored either on the master node of the cluster or in Amazon S3. Each step is performed by the main function of the main class of the JAR file. The main class can be specified either in the manifest of the JAR or by using the MainFunction parameter of the step.
Amazon EMR executes each step in the order listed. For a step to be considered complete, the main function must exit with a zero exit code and all Hadoop jobs started while the step was running must have completed and run successfully.
You can only add steps to a cluster that is in one of the following states: STARTING, BOOTSTRAPPING, RUNNING, or WAITING.
[1]: docs.aws.amazon.com/emr/latest/ManagementGuide/AddMoreThan256Steps.html
452 453 454 455 |
# File 'lib/aws-sdk-emr/client.rb', line 452 def add_job_flow_steps(params = {}, = {}) req = build_request(:add_job_flow_steps, params) req.send_request() end |
#add_tags(params = {}) ⇒ Struct
Adds tags to an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see [Tag Clusters].
[1]: docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-tags.html
494 495 496 497 |
# File 'lib/aws-sdk-emr/client.rb', line 494 def (params = {}, = {}) req = build_request(:add_tags, params) req.send_request() end |
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 |
# File 'lib/aws-sdk-emr/client.rb', line 2186 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config) context[:gem_name] = 'aws-sdk-emr' context[:gem_version] = '1.7.0' Seahorse::Client::Request.new(handlers, context) end |
#cancel_steps(params = {}) ⇒ Types::CancelStepsOutput
Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions 4.8.0 and later, excluding version 5.0.0. A maximum of 256 steps are allowed in each CancelSteps request. CancelSteps is idempotent but asynchronous; it does not guarantee a step will be canceled, even if the request is successfully submitted. You can only cancel steps that are in a ‘PENDING` state.
536 537 538 539 |
# File 'lib/aws-sdk-emr/client.rb', line 536 def cancel_steps(params = {}, = {}) req = build_request(:cancel_steps, params) req.send_request() end |
#create_security_configuration(params = {}) ⇒ Types::CreateSecurityConfigurationOutput
Creates a security configuration, which is stored in the service and can be specified when a cluster is created.
577 578 579 580 |
# File 'lib/aws-sdk-emr/client.rb', line 577 def create_security_configuration(params = {}, = {}) req = build_request(:create_security_configuration, params) req.send_request() end |
#delete_security_configuration(params = {}) ⇒ Struct
Deletes a security configuration.
599 600 601 602 |
# File 'lib/aws-sdk-emr/client.rb', line 599 def delete_security_configuration(params = {}, = {}) req = build_request(:delete_security_configuration, params) req.send_request() end |
#describe_cluster(params = {}) ⇒ Types::DescribeClusterOutput
Provides cluster-level details including status, hardware and software configuration, VPC settings, and so on.
687 688 689 690 |
# File 'lib/aws-sdk-emr/client.rb', line 687 def describe_cluster(params = {}, = {}) req = build_request(:describe_cluster, params) req.send_request() end |
#describe_job_flows(params = {}) ⇒ Types::DescribeJobFlowsOutput
This API is deprecated and will eventually be removed. We recommend you use ListClusters, DescribeCluster, ListSteps, ListInstanceGroups and ListBootstrapActions instead.
DescribeJobFlows returns a list of job flows that match all of the supplied parameters. The parameters can include a list of job flow IDs, job flow states, and restrictions on job flow creation date and time.
Regardless of supplied parameters, only job flows created within the last two months are returned.
If no parameters are supplied, then job flows matching either of the following criteria are returned:
-
Job flows created and completed in the last two weeks
-
Job flows created within the last two months that are in one of the following states: ‘RUNNING`, `WAITING`, `SHUTTING_DOWN`, `STARTING`
Amazon EMR can return a maximum of 512 job flow descriptions.
813 814 815 816 |
# File 'lib/aws-sdk-emr/client.rb', line 813 def describe_job_flows(params = {}, = {}) req = build_request(:describe_job_flows, params) req.send_request() end |
#describe_security_configuration(params = {}) ⇒ Types::DescribeSecurityConfigurationOutput
Provides the details of a security configuration by returning the configuration JSON.
846 847 848 849 |
# File 'lib/aws-sdk-emr/client.rb', line 846 def describe_security_configuration(params = {}, = {}) req = build_request(:describe_security_configuration, params) req.send_request() end |
#describe_step(params = {}) ⇒ Types::DescribeStepOutput
Provides more detail about the cluster step.
895 896 897 898 |
# File 'lib/aws-sdk-emr/client.rb', line 895 def describe_step(params = {}, = {}) req = build_request(:describe_step, params) req.send_request() end |
#list_bootstrap_actions(params = {}) ⇒ Types::ListBootstrapActionsOutput
Provides information about the bootstrap actions associated with a cluster.
935 936 937 938 |
# File 'lib/aws-sdk-emr/client.rb', line 935 def list_bootstrap_actions(params = {}, = {}) req = build_request(:list_bootstrap_actions, params) req.send_request() end |
#list_clusters(params = {}) ⇒ Types::ListClustersOutput
Provides the status of all clusters visible to this AWS account. Allows you to filter the list of clusters based on certain criteria; for example, filtering by cluster creation date and time or by status. This call returns a maximum of 50 clusters per call, but returns a marker to track the paging of the cluster list across multiple ListClusters calls.
993 994 995 996 |
# File 'lib/aws-sdk-emr/client.rb', line 993 def list_clusters(params = {}, = {}) req = build_request(:list_clusters, params) req.send_request() end |
#list_instance_fleets(params = {}) ⇒ Types::ListInstanceFleetsOutput
Lists all available details about the instance fleets in a cluster.
<note markdown=“1”> The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
</note>
1065 1066 1067 1068 |
# File 'lib/aws-sdk-emr/client.rb', line 1065 def list_instance_fleets(params = {}, = {}) req = build_request(:list_instance_fleets, params) req.send_request() end |
#list_instance_groups(params = {}) ⇒ Types::ListInstanceGroupsOutput
Provides all available details about the instance groups in a cluster.
1154 1155 1156 1157 |
# File 'lib/aws-sdk-emr/client.rb', line 1154 def list_instance_groups(params = {}, = {}) req = build_request(:list_instance_groups, params) req.send_request() end |
#list_instances(params = {}) ⇒ Types::ListInstancesOutput
Provides information for all active EC2 instances and EC2 instances terminated in the last 30 days, up to a maximum of 2,000. EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, PROVISIONING, BOOTSTRAPPING, RUNNING.
1233 1234 1235 1236 |
# File 'lib/aws-sdk-emr/client.rb', line 1233 def list_instances(params = {}, = {}) req = build_request(:list_instances, params) req.send_request() end |
#list_security_configurations(params = {}) ⇒ Types::ListSecurityConfigurationsOutput
Lists all the security configurations visible to this account, providing their creation dates and times, and their names. This call returns a maximum of 50 clusters per call, but returns a marker to track the paging of the cluster list across multiple ListSecurityConfigurations calls.
1269 1270 1271 1272 |
# File 'lib/aws-sdk-emr/client.rb', line 1269 def list_security_configurations(params = {}, = {}) req = build_request(:list_security_configurations, params) req.send_request() end |
#list_steps(params = {}) ⇒ Types::ListStepsOutput
Provides a list of steps for the cluster in reverse order unless you specify stepIds with the request.
1332 1333 1334 1335 |
# File 'lib/aws-sdk-emr/client.rb', line 1332 def list_steps(params = {}, = {}) req = build_request(:list_steps, params) req.send_request() end |
#modify_instance_fleet(params = {}) ⇒ Struct
Modifies the target On-Demand and target Spot capacities for the instance fleet with the specified InstanceFleetID within the cluster specified using ClusterID. The call either succeeds or fails atomically.
<note markdown=“1”> The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
</note>
1370 1371 1372 1373 |
# File 'lib/aws-sdk-emr/client.rb', line 1370 def modify_instance_fleet(params = {}, = {}) req = build_request(:modify_instance_fleet, params) req.send_request() end |
#modify_instance_groups(params = {}) ⇒ Struct
ModifyInstanceGroups modifies the number of nodes and configuration settings of an instance group. The input parameters include the new target instance count for the group and the instance group ID. The call will either succeed or fail atomically.
1413 1414 1415 1416 |
# File 'lib/aws-sdk-emr/client.rb', line 1413 def modify_instance_groups(params = {}, = {}) req = build_request(:modify_instance_groups, params) req.send_request() end |
#put_auto_scaling_policy(params = {}) ⇒ Types::PutAutoScalingPolicyOutput
Creates or updates an automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates EC2 instances in response to the value of a CloudWatch metric.
1518 1519 1520 1521 |
# File 'lib/aws-sdk-emr/client.rb', line 1518 def put_auto_scaling_policy(params = {}, = {}) req = build_request(:put_auto_scaling_policy, params) req.send_request() end |
#remove_auto_scaling_policy(params = {}) ⇒ Struct
Removes an automatic scaling policy from a specified instance group within an EMR cluster.
1547 1548 1549 1550 |
# File 'lib/aws-sdk-emr/client.rb', line 1547 def remove_auto_scaling_policy(params = {}, = {}) req = build_request(:remove_auto_scaling_policy, params) req.send_request() end |
#remove_tags(params = {}) ⇒ Struct
Removes tags from an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see [Tag Clusters].
The following example removes the stack tag with value Prod from a cluster:
[1]: docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-tags.html
1584 1585 1586 1587 |
# File 'lib/aws-sdk-emr/client.rb', line 1584 def (params = {}, = {}) req = build_request(:remove_tags, params) req.send_request() end |
#run_job_flow(params = {}) ⇒ Types::RunJobFlowOutput
RunJobFlow creates and starts running a new cluster (job flow). The cluster runs the steps specified. After the steps complete, the cluster stops and the HDFS partition is lost. To prevent loss of data, configure the last step of the job flow to store results in Amazon S3. If the JobFlowInstancesConfig ‘KeepJobFlowAliveWhenNoSteps` parameter is set to `TRUE`, the cluster transitions to the WAITING state rather than shutting down after the steps have completed.
For additional protection, you can set the JobFlowInstancesConfig ‘TerminationProtected` parameter to `TRUE` to lock the cluster and prevent it from being terminated by API call, user intervention, or in the event of a job flow error.
A maximum of 256 steps are allowed in each job flow.
If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using the SSH shell to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop. For more information on how to do this, see [Add More than 256 Steps to a Cluster] in the *Amazon EMR Management Guide*.
For long running clusters, we recommend that you periodically store your results.
<note markdown=“1”> The instance fleets configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions. The RunJobFlow request can contain InstanceFleets parameters or InstanceGroups parameters, but not both.
</note>
[1]: docs.aws.amazon.com/emr/latest/ManagementGuide/AddMoreThan256Steps.html
2055 2056 2057 2058 |
# File 'lib/aws-sdk-emr/client.rb', line 2055 def run_job_flow(params = {}, = {}) req = build_request(:run_job_flow, params) req.send_request() end |
#set_termination_protection(params = {}) ⇒ Struct
SetTerminationProtection locks a cluster (job flow) so the EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling ‘SetTerminationProtection` on a cluster is similar to calling the Amazon EC2 `DisableAPITermination` API on all EC2 instances in a cluster.
‘SetTerminationProtection` is used to prevent accidental termination of a cluster and to ensure that in the event of an error, the instances persist so that you can recover any data stored in their ephemeral instance storage.
To terminate a cluster that has been locked by setting ‘SetTerminationProtection` to `true`, you must first unlock the job flow by a subsequent call to `SetTerminationProtection` in which you set the value to `false`.
For more information, see[Managing Cluster Termination] in the *Amazon EMR Management Guide*.
[1]: docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html
2108 2109 2110 2111 |
# File 'lib/aws-sdk-emr/client.rb', line 2108 def set_termination_protection(params = {}, = {}) req = build_request(:set_termination_protection, params) req.send_request() end |
#set_visible_to_all_users(params = {}) ⇒ Struct
Sets whether all AWS Identity and Access Management (IAM) users under your account can access the specified clusters (job flows). This action works on running clusters. You can also set the visibility of a cluster when you launch it using the ‘VisibleToAllUsers` parameter of RunJobFlow. The SetVisibleToAllUsers action can be called only by an IAM user who created the cluster or the AWS account that owns the cluster.
2145 2146 2147 2148 |
# File 'lib/aws-sdk-emr/client.rb', line 2145 def set_visible_to_all_users(params = {}, = {}) req = build_request(:set_visible_to_all_users, params) req.send_request() end |
#terminate_job_flows(params = {}) ⇒ Struct
TerminateJobFlows shuts a list of clusters (job flows) down. When a job flow is shut down, any step not yet completed is canceled and the EC2 instances on which the cluster is running are stopped. Any log files not already saved are uploaded to Amazon S3 if a LogUri was specified when the cluster was created.
The maximum number of clusters allowed is 10. The call to ‘TerminateJobFlows` is asynchronous. Depending on the configuration of the cluster, it may take up to 1-5 minutes for the cluster to completely terminate and release allocated resources, such as Amazon EC2 instances.
2177 2178 2179 2180 |
# File 'lib/aws-sdk-emr/client.rb', line 2177 def terminate_job_flows(params = {}, = {}) req = build_request(:terminate_job_flows, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
## Basic Usage
A waiter will call an API operation until:
-
It is successful
-
It enters a terminal state
-
It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# polls in a loop, sleeping between attempts
client.waiter_until(waiter_name, params)
## Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
## Callbacks
You can be notified before each polling attempt and before each delay. If you throw ‘:success` or `:failure` from these callbacks, it will terminate the waiter.
started_at = Time.now
client.wait_until(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
## Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
## Valid Waiters
The following table lists the valid waiter names, the operations they call, and the default ‘:delay` and `:max_attempts` values.
| waiter_name | params | :delay | :max_attempts | | —————— | ——————- | ——– | ————- | | cluster_running | #describe_cluster | 30 | 60 | | cluster_terminated | #describe_cluster | 30 | 60 | | step_complete | #describe_step | 30 | 60 |
2289 2290 2291 2292 2293 |
# File 'lib/aws-sdk-emr/client.rb', line 2289 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2297 2298 2299 |
# File 'lib/aws-sdk-emr/client.rb', line 2297 def waiter_names waiters.keys end |