Table of Contents
EMR.
Client
¶A low-level client representing Amazon Elastic MapReduce (EMR):
import boto3
client = boto3.client('emr')
These are the available methods:
add_instance_groups()
add_job_flow_steps()
add_tags()
can_paginate()
describe_cluster()
describe_job_flows()
describe_step()
generate_presigned_url()
get_paginator()
get_waiter()
list_bootstrap_actions()
list_clusters()
list_instance_groups()
list_instances()
list_steps()
modify_instance_groups()
remove_tags()
run_job_flow()
set_termination_protection()
set_visible_to_all_users()
terminate_job_flows()
add_instance_groups
(**kwargs)¶AddInstanceGroups adds an instance group to a running cluster.
Request Syntax
response = client.add_instance_groups(
InstanceGroups=[
{
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceRole': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'InstanceCount': 123,
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
JobFlowId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'JobFlowId': 'string',
'InstanceGroupIds': [
'string',
]
}
Response Structure
|
add_job_flow_steps
(**kwargs)¶AddJobFlowSteps adds new steps to a running job flow. A maximum of 256 steps are allowed in each job flow.
If your job flow 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, go to Add More than 256 Steps to a Job Flow in the Amazon Elastic MapReduce Developer's Guide .
A step specifies the location of a JAR file stored either on the master node of the job flow 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.
Elastic MapReduce 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 job flow that is in one of the following states: STARTING, BOOTSTRAPPING, RUNNING, or WAITING.
Request Syntax
response = client.add_job_flow_steps(
JobFlowId='string',
Steps=[
{
'Name': 'string',
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'HadoopJarStep': {
'Properties': [
{
'Key': 'string',
'Value': 'string'
},
],
'Jar': 'string',
'MainClass': 'string',
'Args': [
'string',
]
}
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'StepIds': [
'string',
]
}
Response Structure
|
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 Tagging Amazon EMR Resources .
Request Syntax
response = client.add_tags(
ResourceId='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
can_paginate
(operation_name)¶Check if an operation can be paginated.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Returns: | True if the operation can be paginated,
False otherwise. |
describe_cluster
(**kwargs)¶Provides cluster-level details including status, hardware and software configuration, VPC settings, and so on. For information about the cluster steps, see ListSteps .
Request Syntax
response = client.describe_cluster(
ClusterId='string'
)
Parameters: | ClusterId (string) -- [REQUIRED] The identifier of the cluster to describe. |
---|---|
Return type: | dict |
Returns: | Response Syntax{
'Cluster': {
'Id': 'string',
'Name': 'string',
'Status': {
'State': 'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'BOOTSTRAP_FAILURE'|'USER_REQUEST'|'STEP_FAILURE'|'ALL_STEPS_COMPLETED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
},
'Ec2InstanceAttributes': {
'Ec2KeyName': 'string',
'Ec2SubnetId': 'string',
'Ec2AvailabilityZone': 'string',
'IamInstanceProfile': 'string',
'EmrManagedMasterSecurityGroup': 'string',
'EmrManagedSlaveSecurityGroup': 'string',
'AdditionalMasterSecurityGroups': [
'string',
],
'AdditionalSlaveSecurityGroups': [
'string',
]
},
'LogUri': 'string',
'RequestedAmiVersion': 'string',
'RunningAmiVersion': 'string',
'ReleaseLabel': 'string',
'AutoTerminate': True|False,
'TerminationProtected': True|False,
'VisibleToAllUsers': True|False,
'Applications': [
{
'Name': 'string',
'Version': 'string',
'Args': [
'string',
],
'AdditionalInfo': {
'string': 'string'
}
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'ServiceRole': 'string',
'NormalizedInstanceHours': 123,
'MasterPublicDnsName': 'string',
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
}
}
Response Structure
|
describe_job_flows
(**kwargs)¶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:
RUNNING
, WAITING
, SHUTTING_DOWN
, STARTING
Amazon Elastic MapReduce can return a maximum of 512 job flow descriptions.
Request Syntax
response = client.describe_job_flows(
CreatedAfter=datetime(2015, 1, 1),
CreatedBefore=datetime(2015, 1, 1),
JobFlowIds=[
'string',
],
JobFlowStates=[
'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'SHUTTING_DOWN'|'TERMINATED'|'COMPLETED'|'FAILED',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'JobFlows': [
{
'JobFlowId': 'string',
'Name': 'string',
'LogUri': 'string',
'AmiVersion': 'string',
'ExecutionStatusDetail': {
'State': 'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'SHUTTING_DOWN'|'TERMINATED'|'COMPLETED'|'FAILED',
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1),
'LastStateChangeReason': 'string'
},
'Instances': {
'MasterInstanceType': 'string',
'MasterPublicDnsName': 'string',
'MasterInstanceId': 'string',
'SlaveInstanceType': 'string',
'InstanceCount': 123,
'InstanceGroups': [
{
'InstanceGroupId': 'string',
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceRole': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'InstanceRequestCount': 123,
'InstanceRunningCount': 123,
'State': 'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'RESIZING'|'SUSPENDED'|'TERMINATING'|'TERMINATED'|'ARRESTED'|'SHUTTING_DOWN'|'ENDED',
'LastStateChangeReason': 'string',
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
},
],
'NormalizedInstanceHours': 123,
'Ec2KeyName': 'string',
'Ec2SubnetId': 'string',
'Placement': {
'AvailabilityZone': 'string'
},
'KeepJobFlowAliveWhenNoSteps': True|False,
'TerminationProtected': True|False,
'HadoopVersion': 'string'
},
'Steps': [
{
'StepConfig': {
'Name': 'string',
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'HadoopJarStep': {
'Properties': [
{
'Key': 'string',
'Value': 'string'
},
],
'Jar': 'string',
'MainClass': 'string',
'Args': [
'string',
]
}
},
'ExecutionStatusDetail': {
'State': 'PENDING'|'RUNNING'|'CONTINUE'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1),
'LastStateChangeReason': 'string'
}
},
],
'BootstrapActions': [
{
'BootstrapActionConfig': {
'Name': 'string',
'ScriptBootstrapAction': {
'Path': 'string',
'Args': [
'string',
]
}
}
},
],
'SupportedProducts': [
'string',
],
'VisibleToAllUsers': True|False,
'JobFlowRole': 'string',
'ServiceRole': 'string'
},
]
}
Response Structure
|
describe_step
(**kwargs)¶Provides more detail about the cluster step.
Request Syntax
response = client.describe_step(
ClusterId='string',
StepId='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Step': {
'Id': 'string',
'Name': 'string',
'Config': {
'Jar': 'string',
'Properties': {
'string': 'string'
},
'MainClass': 'string',
'Args': [
'string',
]
},
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'Status': {
'State': 'PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'StateChangeReason': {
'Code': 'NONE',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
}
}
}
Response Structure
|
generate_presigned_url
(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
Parameters: |
|
---|---|
Returns: | The presigned url |
get_paginator
(operation_name)¶Create a paginator for an operation.
Parameters: | operation_name (string) -- The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo , and you'd normally invoke the
operation as client.create_foo(**kwargs) , if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo") . |
---|---|
Raises OperationNotPageableError: | |
Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
|
Return type: | L{botocore.paginate.Paginator} |
Returns: | A paginator object. |
get_waiter
(waiter_name)¶list_bootstrap_actions
(**kwargs)¶Provides information about the bootstrap actions associated with a cluster.
Request Syntax
response = client.list_bootstrap_actions(
ClusterId='string',
Marker='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'BootstrapActions': [
{
'Name': 'string',
'ScriptPath': 'string',
'Args': [
'string',
]
},
],
'Marker': 'string'
}
Response Structure
|
list_clusters
(**kwargs)¶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.
Request Syntax
response = client.list_clusters(
CreatedAfter=datetime(2015, 1, 1),
CreatedBefore=datetime(2015, 1, 1),
ClusterStates=[
'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
],
Marker='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Clusters': [
{
'Id': 'string',
'Name': 'string',
'Status': {
'State': 'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'BOOTSTRAP_FAILURE'|'USER_REQUEST'|'STEP_FAILURE'|'ALL_STEPS_COMPLETED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
},
'NormalizedInstanceHours': 123
},
],
'Marker': 'string'
}
Response Structure
|
list_instance_groups
(**kwargs)¶Provides all available details about the instance groups in a cluster.
Request Syntax
response = client.list_instance_groups(
ClusterId='string',
Marker='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceGroups': [
{
'Id': 'string',
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceGroupType': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'RequestedInstanceCount': 123,
'RunningInstanceCount': 123,
'Status': {
'State': 'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'RESIZING'|'SUSPENDED'|'TERMINATING'|'TERMINATED'|'ARRESTED'|'SHUTTING_DOWN'|'ENDED',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'CLUSTER_TERMINATED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
},
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'Marker': 'string'
}
Response Structure
|
list_instances
(**kwargs)¶Provides information about the cluster instances that Amazon EMR provisions on behalf of a user when it creates the cluster. For example, this operation indicates when the EC2 instances reach the Ready state, when instances become available to Amazon EMR to use for jobs, and the IP addresses for cluster instances, etc.
Request Syntax
response = client.list_instances(
ClusterId='string',
InstanceGroupId='string',
InstanceGroupTypes=[
'MASTER'|'CORE'|'TASK',
],
Marker='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Instances': [
{
'Id': 'string',
'Ec2InstanceId': 'string',
'PublicDnsName': 'string',
'PublicIpAddress': 'string',
'PrivateDnsName': 'string',
'PrivateIpAddress': 'string',
'Status': {
'State': 'AWAITING_FULFILLMENT'|'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'TERMINATED',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'BOOTSTRAP_FAILURE'|'CLUSTER_TERMINATED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
}
},
],
'Marker': 'string'
}
Response Structure
|
list_steps
(**kwargs)¶Provides a list of steps for the cluster.
Request Syntax
response = client.list_steps(
ClusterId='string',
StepStates=[
'PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
],
StepIds=[
'string',
],
Marker='string'
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Steps': [
{
'Id': 'string',
'Name': 'string',
'Config': {
'Jar': 'string',
'Properties': {
'string': 'string'
},
'MainClass': 'string',
'Args': [
'string',
]
},
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'Status': {
'State': 'PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'StateChangeReason': {
'Code': 'NONE',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
}
},
],
'Marker': 'string'
}
Response Structure
|
modify_instance_groups
(**kwargs)¶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.
Request Syntax
response = client.modify_instance_groups(
InstanceGroups=[
{
'InstanceGroupId': 'string',
'InstanceCount': 123,
'EC2InstanceIdsToTerminate': [
'string',
]
},
]
)
Parameters: | InstanceGroups (list) -- Instance groups to change.
|
---|---|
Returns: | None |
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 Tagging Amazon EMR Resources .
The following example removes the stack tag with value Prod from a cluster:
Request Syntax
response = client.remove_tags(
ResourceId='string',
TagKeys=[
'string',
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {}
Response Structure
|
run_job_flow
(**kwargs)¶RunJobFlow creates and starts running a new job flow. The job flow will run the steps specified. Once the job flow completes, the cluster is stopped 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 job flow will transition to the WAITING state rather than shutting down once the steps have completed.
For additional protection, you can set the JobFlowInstancesConfig TerminationProtected
parameter to TRUE
to lock the job flow 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 job flow 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, go to Add More than 256 Steps to a Job Flow in the Amazon Elastic MapReduce Developer's Guide .
For long running job flows, we recommend that you periodically store your results.
Request Syntax
response = client.run_job_flow(
Name='string',
LogUri='string',
AdditionalInfo='string',
AmiVersion='string',
ReleaseLabel='string',
Instances={
'MasterInstanceType': 'string',
'SlaveInstanceType': 'string',
'InstanceCount': 123,
'InstanceGroups': [
{
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceRole': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'InstanceCount': 123,
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'Ec2KeyName': 'string',
'Placement': {
'AvailabilityZone': 'string'
},
'KeepJobFlowAliveWhenNoSteps': True|False,
'TerminationProtected': True|False,
'HadoopVersion': 'string',
'Ec2SubnetId': 'string',
'EmrManagedMasterSecurityGroup': 'string',
'EmrManagedSlaveSecurityGroup': 'string',
'AdditionalMasterSecurityGroups': [
'string',
],
'AdditionalSlaveSecurityGroups': [
'string',
]
},
Steps=[
{
'Name': 'string',
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'HadoopJarStep': {
'Properties': [
{
'Key': 'string',
'Value': 'string'
},
],
'Jar': 'string',
'MainClass': 'string',
'Args': [
'string',
]
}
},
],
BootstrapActions=[
{
'Name': 'string',
'ScriptBootstrapAction': {
'Path': 'string',
'Args': [
'string',
]
}
},
],
SupportedProducts=[
'string',
],
NewSupportedProducts=[
{
'Name': 'string',
'Args': [
'string',
]
},
],
Applications=[
{
'Name': 'string',
'Version': 'string',
'Args': [
'string',
],
'AdditionalInfo': {
'string': 'string'
}
},
],
Configurations=[
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
VisibleToAllUsers=True|False,
JobFlowRole='string',
ServiceRole='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'JobFlowId': 'string'
}
Response Structure
|
set_termination_protection
(**kwargs)¶SetTerminationProtection locks a job flow so the Amazon 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 job flow is analogous to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances in a cluster.
SetTerminationProtection is used to prevent accidental termination of a job flow and to ensure that in the event of an error, the instances will persist so you can recover any data stored in their ephemeral instance storage.
To terminate a job flow 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, go to Protecting a Job Flow from Termination in the Amazon Elastic MapReduce Developer's Guide.
Request Syntax
response = client.set_termination_protection(
JobFlowIds=[
'string',
],
TerminationProtected=True|False
)
Parameters: |
|
---|---|
Returns: | None |
set_visible_to_all_users
(**kwargs)¶Sets whether all AWS Identity and Access Management (IAM) users under your account can access the specified job flows. This action works on running job flows. You can also set the visibility of a job flow when you launch it using the VisibleToAllUsers
parameter of RunJobFlow . The SetVisibleToAllUsers action can be called only by an IAM user who created the job flow or the AWS account that owns the job flow.
Request Syntax
response = client.set_visible_to_all_users(
JobFlowIds=[
'string',
],
VisibleToAllUsers=True|False
)
Parameters: |
|
---|---|
Returns: | None |
terminate_job_flows
(**kwargs)¶TerminateJobFlows shuts a list of job flows down. When a job flow is shut down, any step not yet completed is canceled and the EC2 instances on which the job flow is running are stopped. Any log files not already saved are uploaded to Amazon S3 if a LogUri was specified when the job flow was created.
The maximum number of JobFlows allowed is 10. The call to TerminateJobFlows is asynchronous. Depending on the configuration of the job flow, it may take up to 5-20 minutes for the job flow to completely terminate and release allocated resources, such as Amazon EC2 instances.
Request Syntax
response = client.terminate_job_flows(
JobFlowIds=[
'string',
]
)
Parameters: | JobFlowIds (list) -- [REQUIRED] A list of job flows to be shutdown.
|
---|---|
Returns: | None |
The available paginators are:
EMR.Paginator.list_bootstrap_actions
EMR.Paginator.list_clusters
EMR.Paginator.list_instance_groups
EMR.Paginator.list_instances
EMR.Paginator.list_steps
EMR.Paginator.
list_bootstrap_actions
¶paginator = client.get_paginator('list_bootstrap_actions')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_bootstrap_actions()
.
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'BootstrapActions': [
{
'Name': 'string',
'ScriptPath': 'string',
'Args': [
'string',
]
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.
list_clusters
¶paginator = client.get_paginator('list_clusters')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_clusters()
.
Request Syntax
response_iterator = paginator.paginate(
CreatedAfter=datetime(2015, 1, 1),
CreatedBefore=datetime(2015, 1, 1),
ClusterStates=[
'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Clusters': [
{
'Id': 'string',
'Name': 'string',
'Status': {
'State': 'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'BOOTSTRAP_FAILURE'|'USER_REQUEST'|'STEP_FAILURE'|'ALL_STEPS_COMPLETED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
},
'NormalizedInstanceHours': 123
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.
list_instance_groups
¶paginator = client.get_paginator('list_instance_groups')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_instance_groups()
.
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'InstanceGroups': [
{
'Id': 'string',
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceGroupType': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'RequestedInstanceCount': 123,
'RunningInstanceCount': 123,
'Status': {
'State': 'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'RESIZING'|'SUSPENDED'|'TERMINATING'|'TERMINATED'|'ARRESTED'|'SHUTTING_DOWN'|'ENDED',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'CLUSTER_TERMINATED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
},
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.
list_instances
¶paginator = client.get_paginator('list_instances')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_instances()
.
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
InstanceGroupId='string',
InstanceGroupTypes=[
'MASTER'|'CORE'|'TASK',
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Instances': [
{
'Id': 'string',
'Ec2InstanceId': 'string',
'PublicDnsName': 'string',
'PublicIpAddress': 'string',
'PrivateDnsName': 'string',
'PrivateIpAddress': 'string',
'Status': {
'State': 'AWAITING_FULFILLMENT'|'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'TERMINATED',
'StateChangeReason': {
'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'BOOTSTRAP_FAILURE'|'CLUSTER_TERMINATED',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'ReadyDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
}
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.
list_steps
¶paginator = client.get_paginator('list_steps')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_steps()
.
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
StepStates=[
'PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
],
StepIds=[
'string',
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
Parameters: |
|
---|---|
Return type: | dict |
Returns: | Response Syntax {
'Steps': [
{
'Id': 'string',
'Name': 'string',
'Config': {
'Jar': 'string',
'Properties': {
'string': 'string'
},
'MainClass': 'string',
'Args': [
'string',
]
},
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'Status': {
'State': 'PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'StateChangeReason': {
'Code': 'NONE',
'Message': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
}
},
],
'NextToken': 'string'
}
Response Structure
|
The available waiters are:
EMR.Waiter.
cluster_running
¶waiter = client.get_waiter('cluster_running')
wait
(**kwargs)¶This polls EMR.Client.describe_cluster()
every 30 seconds until a successful state is reached. An error is returned after 60 failed checks.
Request Syntax
waiter.wait(
ClusterId='string'
)
Parameters: | ClusterId (string) -- [REQUIRED] The identifier of the cluster to describe. |
---|---|
Returns: | None |