You can use the SetKeepJobFlowAliveWhenNoSteps to configure a cluster (job flow) to terminate after the step execution, i.e., all your steps are executed. If you want a transient cluster that shuts down after the last of the current executing steps are completed, you can configure SetKeepJobFlowAliveWhenNoSteps to false. If you want a long running cluster, configure SetKeepJobFlowAliveWhenNoSteps to true.
For more information, see Managing Cluster Termination in the Amazon EMR Management Guide.
Parameters:
-
job_flow_ids
(Optional[XmlStringList], default:
None
)
–
A list of strings that uniquely identify the clusters to protect. This identifier is returned by RunJobFlow and can also be obtained from DescribeJobFlows.
-
keep_job_flow_alive_when_no_steps
(Optional[Boolean], default:
None
)
–
A Boolean that indicates whether to terminate the cluster after all steps are executed.
Raises:
-
InternalServerError
–
Indicates that an error occurred while processing the request and that the request was not completed.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_emr/_services/emr.py
| def set_keep_job_flow_alive_when_no_steps(
self,
*,
config_overrides: Optional[EMRClientConfig] = None,
job_flow_ids: Optional["capo_emr.types.xml_string_list.XmlStringList"] = None,
keep_job_flow_alive_when_no_steps: Optional[
"capo_emr.types.boolean.Boolean"
] = None,
) -> None:
"""<p>You can use the <code>SetKeepJobFlowAliveWhenNoSteps</code> to configure a cluster (job flow) to terminate after the step execution, i.e., all your steps are executed. If you want a transient cluster that shuts down after the last of the current executing steps are completed, you can configure <code>SetKeepJobFlowAliveWhenNoSteps</code> to false. If you want a long running cluster, configure <code>SetKeepJobFlowAliveWhenNoSteps</code> to true.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html">Managing Cluster Termination</a> in the <i>Amazon EMR Management Guide</i>.</p>
Args:
job_flow_ids: <p>A list of strings that uniquely identify the clusters to protect. This identifier is returned by <a href="https://docs.aws.amazon.com/emr/latest/APIReference/API_RunJobFlow.html">RunJobFlow</a> and can also be obtained from <a href="https://docs.aws.amazon.com/emr/latest/APIReference/API_DescribeJobFlows.html">DescribeJobFlows</a>.</p>
keep_job_flow_alive_when_no_steps: <p>A Boolean that indicates whether to terminate the cluster after all steps are executed.</p>
Raises:
capo_emr.errors.internal_server_error.InternalServerError: <p>Indicates that an error occurred while processing the request and that the request was not completed.</p>
capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_emr.types.set_keep_job_flow_alive_when_no_steps_input.SetKeepJobFlowAliveWhenNoStepsInput]",
) -> OperationResponse[None]:
import capo_emr._operations.elastic_map_reduce.set_keep_job_flow_alive_when_no_steps
output, http_response = (
capo_emr._operations.elastic_map_reduce.set_keep_job_flow_alive_when_no_steps.set_keep_job_flow_alive_when_no_steps(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SetKeepJobFlowAliveWhenNoSteps")
)
input_: capo_emr.types.set_keep_job_flow_alive_when_no_steps_input.SetKeepJobFlowAliveWhenNoStepsInput = {}
if job_flow_ids is not None:
input_["job_flow_ids"] = job_flow_ids
if keep_job_flow_alive_when_no_steps is not None:
input_["keep_job_flow_alive_when_no_steps"] = (
keep_job_flow_alive_when_no_steps
)
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|