Table of Contents
EMR.Client¶A low-level client representing Amazon Elastic MapReduce (EMR):
client = session.create_client('emr')
These are the available methods:
add_instance_fleet()add_instance_groups()add_job_flow_steps()add_tags()can_paginate()cancel_steps()create_security_configuration()delete_security_configuration()describe_cluster()describe_job_flows()describe_security_configuration()describe_step()generate_presigned_url()get_paginator()get_waiter()list_bootstrap_actions()list_clusters()list_instance_fleets()list_instance_groups()list_instances()list_security_configurations()list_steps()modify_instance_fleet()modify_instance_groups()put_auto_scaling_policy()remove_auto_scaling_policy()remove_tags()run_job_flow()set_termination_protection()set_visible_to_all_users()terminate_job_flows()add_instance_fleet(**kwargs)¶Adds an instance fleet to a running cluster.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x.
See also: AWS API Documentation
Request Syntax
response = client.add_instance_fleet(
ClusterId='string',
InstanceFleet={
'Name': 'string',
'InstanceFleetType': 'MASTER'|'CORE'|'TASK',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123,
'InstanceTypeConfigs': [
{
'InstanceType': 'string',
'WeightedCapacity': 123,
'BidPrice': 'string',
'BidPriceAsPercentageOfOnDemandPrice': 123.0,
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'LaunchSpecifications': {
'SpotSpecification': {
'TimeoutDurationMinutes': 123,
'TimeoutAction': 'SWITCH_TO_ON_DEMAND'|'TERMINATE_CLUSTER',
'BlockDurationMinutes': 123
}
}
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'ClusterId': 'string',
'InstanceFleetId': 'string'
}
Response Structure
|
add_instance_groups(**kwargs)¶Adds one or more instance groups to a running cluster.
See also: AWS API Documentation
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'
}
},
],
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'AutoScalingPolicy': {
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': '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 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.
See also: AWS API Documentation
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 .
See also: AWS API Documentation
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. |
cancel_steps(**kwargs)¶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.
See also: AWS API Documentation
Request Syntax
response = client.cancel_steps(
ClusterId='string',
StepIds=[
'string',
]
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'CancelStepsInfoList': [
{
'StepId': 'string',
'Status': 'SUBMITTED'|'FAILED',
'Reason': 'string'
},
]
}
Response Structure
|
create_security_configuration(**kwargs)¶Creates a security configuration, which is stored in the service and can be specified when a cluster is created.
See also: AWS API Documentation
Request Syntax
response = client.create_security_configuration(
Name='string',
SecurityConfiguration='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'Name': 'string',
'CreationDateTime': datetime(2015, 1, 1)
}
Response Structure
|
delete_security_configuration(**kwargs)¶Deletes a security configuration.
See also: AWS API Documentation
Request Syntax
response = client.delete_security_configuration(
Name='string'
)
| Parameters: | Name (string) – [REQUIRED] The name of the security configuration. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
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 .
See also: AWS API Documentation
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'|'INSTANCE_FLEET_TIMEOUT'|'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',
'RequestedEc2SubnetIds': [
'string',
],
'Ec2AvailabilityZone': 'string',
'RequestedEc2AvailabilityZones': [
'string',
],
'IamInstanceProfile': 'string',
'EmrManagedMasterSecurityGroup': 'string',
'EmrManagedSlaveSecurityGroup': 'string',
'ServiceAccessSecurityGroup': 'string',
'AdditionalMasterSecurityGroups': [
'string',
],
'AdditionalSlaveSecurityGroups': [
'string',
]
},
'InstanceCollectionType': 'INSTANCE_FLEET'|'INSTANCE_GROUP',
'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'
}
},
],
'SecurityConfiguration': 'string',
'AutoScalingRole': 'string',
'ScaleDownBehavior': 'TERMINATE_AT_INSTANCE_HOUR'|'TERMINATE_AT_TASK_COMPLETION',
'CustomAmiId': 'string',
'EbsRootVolumeSize': 123,
'RepoUpgradeOnBoot': 'SECURITY'|'NONE'
}
}
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 , STARTINGAmazon EMR can return a maximum of 512 job flow descriptions.
See also: AWS API Documentation
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',
'AvailabilityZones': [
'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',
'AutoScalingRole': 'string',
'ScaleDownBehavior': 'TERMINATE_AT_INSTANCE_HOUR'|'TERMINATE_AT_TASK_COMPLETION'
},
]
}
Response Structure
|
describe_security_configuration(**kwargs)¶Provides the details of a security configuration by returning the configuration JSON.
See also: AWS API Documentation
Request Syntax
response = client.describe_security_configuration(
Name='string'
)
| Parameters: | Name (string) – [REQUIRED] The name of the security configuration. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'Name': 'string',
'SecurityConfiguration': 'string',
'CreationDateTime': datetime(2015, 1, 1)
}
Response Structure
|
describe_step(**kwargs)¶Provides more detail about the cluster step.
See also: AWS API Documentation
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'|'CANCEL_PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'StateChangeReason': {
'Code': 'NONE',
'Message': 'string'
},
'FailureDetails': {
'Reason': 'string',
'Message': 'string',
'LogFile': '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.
See also: AWS API Documentation
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.
See also: AWS API Documentation
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'|'INSTANCE_FLEET_TIMEOUT'|'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_fleets(**kwargs)¶Lists all available details about the instance fleets in a cluster.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
See also: AWS API Documentation
Request Syntax
response = client.list_instance_fleets(
ClusterId='string',
Marker='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'InstanceFleets': [
{
'Id': 'string',
'Name': 'string',
'Status': {
'State': 'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'RESIZING'|'SUSPENDED'|'TERMINATING'|'TERMINATED',
'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)
}
},
'InstanceFleetType': 'MASTER'|'CORE'|'TASK',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123,
'ProvisionedOnDemandCapacity': 123,
'ProvisionedSpotCapacity': 123,
'InstanceTypeSpecifications': [
{
'InstanceType': 'string',
'WeightedCapacity': 123,
'BidPrice': 'string',
'BidPriceAsPercentageOfOnDemandPrice': 123.0,
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
'EbsBlockDevices': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'Device': 'string'
},
],
'EbsOptimized': True|False
},
],
'LaunchSpecifications': {
'SpotSpecification': {
'TimeoutDurationMinutes': 123,
'TimeoutAction': 'SWITCH_TO_ON_DEMAND'|'TERMINATE_CLUSTER',
'BlockDurationMinutes': 123
}
}
},
],
'Marker': 'string'
}
Response Structure
|
list_instance_groups(**kwargs)¶Provides all available details about the instance groups in a cluster.
See also: AWS API Documentation
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'
}
},
],
'EbsBlockDevices': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'Device': 'string'
},
],
'EbsOptimized': True|False,
'ShrinkPolicy': {
'DecommissionTimeout': 123,
'InstanceResizePolicy': {
'InstancesToTerminate': [
'string',
],
'InstancesToProtect': [
'string',
],
'InstanceTerminationTimeout': 123
}
},
'AutoScalingPolicy': {
'Status': {
'State': 'PENDING'|'ATTACHING'|'ATTACHED'|'DETACHING'|'DETACHED'|'FAILED',
'StateChangeReason': {
'Code': 'USER_REQUEST'|'PROVISION_FAILURE'|'CLEANUP_FAILURE',
'Message': 'string'
}
},
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
},
],
'Marker': 'string'
}
Response Structure
|
list_instances(**kwargs)¶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.
See also: AWS API Documentation
Request Syntax
response = client.list_instances(
ClusterId='string',
InstanceGroupId='string',
InstanceGroupTypes=[
'MASTER'|'CORE'|'TASK',
],
InstanceFleetId='string',
InstanceFleetType='MASTER'|'CORE'|'TASK',
InstanceStates=[
'AWAITING_FULFILLMENT'|'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'TERMINATED',
],
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)
}
},
'InstanceGroupId': 'string',
'InstanceFleetId': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceType': 'string',
'EbsVolumes': [
{
'Device': 'string',
'VolumeId': 'string'
},
]
},
],
'Marker': 'string'
}
Response Structure
|
list_security_configurations(**kwargs)¶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.
See also: AWS API Documentation
Request Syntax
response = client.list_security_configurations(
Marker='string'
)
| Parameters: | Marker (string) – The pagination token that indicates the set of results to retrieve. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'SecurityConfigurations': [
{
'Name': 'string',
'CreationDateTime': datetime(2015, 1, 1)
},
],
'Marker': 'string'
}
Response Structure
|
list_steps(**kwargs)¶Provides a list of steps for the cluster in reverse order unless you specify stepIds with the request.
See also: AWS API Documentation
Request Syntax
response = client.list_steps(
ClusterId='string',
StepStates=[
'PENDING'|'CANCEL_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'|'CANCEL_PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'StateChangeReason': {
'Code': 'NONE',
'Message': 'string'
},
'FailureDetails': {
'Reason': 'string',
'Message': 'string',
'LogFile': 'string'
},
'Timeline': {
'CreationDateTime': datetime(2015, 1, 1),
'StartDateTime': datetime(2015, 1, 1),
'EndDateTime': datetime(2015, 1, 1)
}
}
},
],
'Marker': 'string'
}
Response Structure
|
modify_instance_fleet(**kwargs)¶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
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
See also: AWS API Documentation
Request Syntax
response = client.modify_instance_fleet(
ClusterId='string',
InstanceFleet={
'InstanceFleetId': 'string',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123
}
)
| Parameters: |
|
|---|---|
| Returns: | None |
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.
See also: AWS API Documentation
Request Syntax
response = client.modify_instance_groups(
ClusterId='string',
InstanceGroups=[
{
'InstanceGroupId': 'string',
'InstanceCount': 123,
'EC2InstanceIdsToTerminate': [
'string',
],
'ShrinkPolicy': {
'DecommissionTimeout': 123,
'InstanceResizePolicy': {
'InstancesToTerminate': [
'string',
],
'InstancesToProtect': [
'string',
],
'InstanceTerminationTimeout': 123
}
}
},
]
)
| Parameters: |
|
|---|---|
| Returns: | None |
put_auto_scaling_policy(**kwargs)¶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.
See also: AWS API Documentation
Request Syntax
response = client.put_auto_scaling_policy(
ClusterId='string',
InstanceGroupId='string',
AutoScalingPolicy={
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'ClusterId': 'string',
'InstanceGroupId': 'string',
'AutoScalingPolicy': {
'Status': {
'State': 'PENDING'|'ATTACHING'|'ATTACHED'|'DETACHING'|'DETACHED'|'FAILED',
'StateChangeReason': {
'Code': 'USER_REQUEST'|'PROVISION_FAILURE'|'CLEANUP_FAILURE',
'Message': 'string'
}
},
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
}
Response Structure
|
remove_auto_scaling_policy(**kwargs)¶Removes an automatic scaling policy from a specified instance group within an EMR cluster.
See also: AWS API Documentation
Request Syntax
response = client.remove_auto_scaling_policy(
ClusterId='string',
InstanceGroupId='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
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:
See also: AWS API Documentation
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 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
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.
See also: AWS API Documentation
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'
}
},
],
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'AutoScalingPolicy': {
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
},
],
'InstanceFleets': [
{
'Name': 'string',
'InstanceFleetType': 'MASTER'|'CORE'|'TASK',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123,
'InstanceTypeConfigs': [
{
'InstanceType': 'string',
'WeightedCapacity': 123,
'BidPrice': 'string',
'BidPriceAsPercentageOfOnDemandPrice': 123.0,
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'LaunchSpecifications': {
'SpotSpecification': {
'TimeoutDurationMinutes': 123,
'TimeoutAction': 'SWITCH_TO_ON_DEMAND'|'TERMINATE_CLUSTER',
'BlockDurationMinutes': 123
}
}
},
],
'Ec2KeyName': 'string',
'Placement': {
'AvailabilityZone': 'string',
'AvailabilityZones': [
'string',
]
},
'KeepJobFlowAliveWhenNoSteps': True|False,
'TerminationProtected': True|False,
'HadoopVersion': 'string',
'Ec2SubnetId': 'string',
'Ec2SubnetIds': [
'string',
],
'EmrManagedMasterSecurityGroup': 'string',
'EmrManagedSlaveSecurityGroup': 'string',
'ServiceAccessSecurityGroup': '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'
},
],
SecurityConfiguration='string',
AutoScalingRole='string',
ScaleDownBehavior='TERMINATE_AT_INSTANCE_HOUR'|'TERMINATE_AT_TASK_COMPLETION',
CustomAmiId='string',
EbsRootVolumeSize=123,
RepoUpgradeOnBoot='SECURITY'|'NONE'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'JobFlowId': 'string'
}
Response Structure
|
set_termination_protection(**kwargs)¶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.
SetTerminationProtectionis 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 <http://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html>`_ in the Amazon EMR Management Guide .
See also: AWS API Documentation
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 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.
See also: AWS API Documentation
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 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.
See also: AWS API Documentation
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.ListBootstrapActionsEMR.Paginator.ListClustersEMR.Paginator.ListInstanceFleetsEMR.Paginator.ListInstanceGroupsEMR.Paginator.ListInstancesEMR.Paginator.ListStepsEMR.Paginator.ListBootstrapActions¶paginator = client.get_paginator('list_bootstrap_actions')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_bootstrap_actions().
See also: AWS API Documentation
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.ListClusters¶paginator = client.get_paginator('list_clusters')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_clusters().
See also: AWS API Documentation
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'|'INSTANCE_FLEET_TIMEOUT'|'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.ListInstanceFleets¶paginator = client.get_paginator('list_instance_fleets')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_instance_fleets().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'InstanceFleets': [
{
'Id': 'string',
'Name': 'string',
'Status': {
'State': 'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'RESIZING'|'SUSPENDED'|'TERMINATING'|'TERMINATED',
'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)
}
},
'InstanceFleetType': 'MASTER'|'CORE'|'TASK',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123,
'ProvisionedOnDemandCapacity': 123,
'ProvisionedSpotCapacity': 123,
'InstanceTypeSpecifications': [
{
'InstanceType': 'string',
'WeightedCapacity': 123,
'BidPrice': 'string',
'BidPriceAsPercentageOfOnDemandPrice': 123.0,
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
'EbsBlockDevices': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'Device': 'string'
},
],
'EbsOptimized': True|False
},
],
'LaunchSpecifications': {
'SpotSpecification': {
'TimeoutDurationMinutes': 123,
'TimeoutAction': 'SWITCH_TO_ON_DEMAND'|'TERMINATE_CLUSTER',
'BlockDurationMinutes': 123
}
}
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.ListInstanceGroups¶paginator = client.get_paginator('list_instance_groups')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_instance_groups().
See also: AWS API Documentation
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'
}
},
],
'EbsBlockDevices': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'Device': 'string'
},
],
'EbsOptimized': True|False,
'ShrinkPolicy': {
'DecommissionTimeout': 123,
'InstanceResizePolicy': {
'InstancesToTerminate': [
'string',
],
'InstancesToProtect': [
'string',
],
'InstanceTerminationTimeout': 123
}
},
'AutoScalingPolicy': {
'Status': {
'State': 'PENDING'|'ATTACHING'|'ATTACHED'|'DETACHING'|'DETACHED'|'FAILED',
'StateChangeReason': {
'Code': 'USER_REQUEST'|'PROVISION_FAILURE'|'CLEANUP_FAILURE',
'Message': 'string'
}
},
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.ListInstances¶paginator = client.get_paginator('list_instances')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_instances().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
InstanceGroupId='string',
InstanceGroupTypes=[
'MASTER'|'CORE'|'TASK',
],
InstanceFleetId='string',
InstanceFleetType='MASTER'|'CORE'|'TASK',
InstanceStates=[
'AWAITING_FULFILLMENT'|'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'TERMINATED',
],
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)
}
},
'InstanceGroupId': 'string',
'InstanceFleetId': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceType': 'string',
'EbsVolumes': [
{
'Device': 'string',
'VolumeId': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
|
EMR.Paginator.ListSteps¶paginator = client.get_paginator('list_steps')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from EMR.Client.list_steps().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
ClusterId='string',
StepStates=[
'PENDING'|'CANCEL_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'|'CANCEL_PENDING'|'RUNNING'|'COMPLETED'|'CANCELLED'|'FAILED'|'INTERRUPTED',
'StateChangeReason': {
'Code': 'NONE',
'Message': 'string'
},
'FailureDetails': {
'Reason': 'string',
'Message': 'string',
'LogFile': '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.ClusterRunning¶waiter = client.get_waiter('cluster_running')
wait(**kwargs)¶Polls EMR.Client.describe_cluster() every 30 seconds until a successful state is reached. An error is returned after 60 failed checks.
See also: AWS API Documentation
Request Syntax
waiter.wait(
ClusterId='string'
)
| Parameters: | ClusterId (string) – [REQUIRED] The identifier of the cluster to describe. |
|---|---|
| Returns: | None |
EMR.Waiter.ClusterTerminated¶waiter = client.get_waiter('cluster_terminated')
wait(**kwargs)¶Polls EMR.Client.describe_cluster() every 30 seconds until a successful state is reached. An error is returned after 60 failed checks.
See also: AWS API Documentation
Request Syntax
waiter.wait(
ClusterId='string'
)
| Parameters: | ClusterId (string) – [REQUIRED] The identifier of the cluster to describe. |
|---|---|
| Returns: | None |