@@ -130,6 +130,10 @@ def _build_cluster_args(**pars: Any) -> Dict[str, Any]: # pylint: disable=too-m
130
130
"StepConcurrencyLevel" : pars ["step_concurrency_level" ],
131
131
}
132
132
133
+ # Auto Termination Policy
134
+ if pars ["auto_termination_policy" ] is not None :
135
+ args ["AutoTerminationPolicy" ] = pars ["auto_termination_policy" ]
136
+
133
137
# Custom AMI
134
138
if pars ["custom_ami_id" ] is not None :
135
139
args ["CustomAmiId" ] = pars ["custom_ami_id" ]
@@ -452,6 +456,7 @@ def create_cluster( # pylint: disable=too-many-arguments,too-many-locals,unused
452
456
step_concurrency_level : int = 1 ,
453
457
keep_cluster_alive_when_no_steps : bool = True ,
454
458
termination_protected : bool = False ,
459
+ auto_termination_policy : Optional [Dict [str , int ]] = None ,
455
460
tags : Optional [Dict [str , str ]] = None ,
456
461
boto3_session : Optional [boto3 .Session ] = None ,
457
462
) -> str :
@@ -604,6 +609,11 @@ def create_cluster( # pylint: disable=too-many-arguments,too-many-locals,unused
604
609
Specifies whether the Amazon EC2 instances in the cluster are
605
610
protected from termination by API calls, user intervention,
606
611
or in the event of a job-flow error.
612
+ auto_termination_policy: Optional[Dict[str, int]]
613
+ Specifies the auto-termination policy that is attached to an Amazon EMR cluster
614
+ eg. auto_termination_policy = {'IdleTimeout': 123}
615
+ IdleTimeout specifies the amount of idle time in seconds after which the cluster automatically terminates.
616
+ You can specify a minimum of 60 seconds and a maximum of 604800 seconds (seven days).
607
617
tags : Dict[str, str], optional
608
618
Key/Value collection to put on the Cluster.
609
619
e.g. {"foo": "boo", "bar": "xoo"})
0 commit comments