reduceContext.isRestarted

Property Description

Indicates whether the reduce(reduceContext) function has been invoked previously for the current key and values.

For an overview of events that can cause a restart, see System Response After a Map/Reduce Interruption.

When the reduce function is restarted for a key-value pair, data previously written by the incomplete function is deleted. However, some of the function’s logic might have been executed before the function invocation was interrupted. For that reason, if the reduceContext.isRestarted property is true, your script should take the necessary actions to avoid duplicate processing. For examples, see Adding Logic to Handle Map/Reduce Restarts.

Related properties include reduceContext.executionNo and reduceContext.errors.

Type

boolean

Since

2016.1

Syntax

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see Map/Reduce Script Samples.

          // Add additional code.
...
function reduce (context) {
    if (context.isRestarted)
    {
        // Add logic designed to assess how much processing was completed for this key
        // and react accordingly. 
    }
    else
    {
        // Let full processing continue for the current key and its values.
    }
  ...
// Add additional code. 

        

Related Topics

reduceContext
reduceContext.executionNo
reduceContext.errors
reduceContext.key
reduceContext.values
reduceContext.write(options)

General Notices