set_termination_protection ( $job_flow_ids, $termination_protected, $opt )

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.

Access

public

Parameters

Parameter

Type

Required

Description

$job_flow_ids

string
array

Required

A list of strings that uniquely identify the job flows to protect. This identifier is returned by RunJobFlow and can also be obtained from DescribeJobFlows. Pass a string for a single value, or an indexed array for multiple values.

$termination_protected

boolean

Required

A Boolean that indicates whether to protect the job flow and prevent the Amazon EC2 instances in the cluster from shutting down due to API calls, user intervention, or job-flow error.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Lock 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.

$emr = new AmazonEMR();

$response = $emr->set_termination_protection(array('j-147KUX35ZRCTI', 'j-853ITCRZ65XUK'), 'true');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Unlock 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.

$emr = new AmazonEMR();

$response = $emr->set_termination_protection(array('j-147KUX35ZRCTI', 'j-853ITCRZ65XUK'), 'false');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Source

Method defined in services/emr.class.php | Toggle source view (12 lines) | View on GitHub

public function set_termination_protection($job_flow_ids, $termination_protected, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['TerminationProtected'] = $termination_protected;
    
    // Required list (non-map)
    $opt = array_merge($opt, CFComplexType::map(array(
        'JobFlowIds' => (is_array($job_flow_ids) ? $job_flow_ids : array($job_flow_ids))
    ), 'member'));

    return $this->authenticate('SetTerminationProtection', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback