reduceContext.executionNo

Property Description

Indicates whether the current invocation of the reduce(reduceContext) function is the first, second, third, or fourth for the current key and its 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, 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, you may want to use the reduceContext.executionNo property to provide logic designed to avoid duplicate processing.

For examples of how to write a robust map/reduce script, see Adding Logic to Handle Map/Reduce Restarts.

Related properties include reduceContext.isRestarted and reduceContext.errors.

Type

number

Since

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

if (context.executionNo === 1){
    // Permit full processing of the key-value pair.
}

else if (context.executionNo === 2){
    // Take steps to check whether any processing was previously completed.
}
              
else {
    // Take other steps that might be necessary in the case of more than
    // one previous attempt.                    
}
...
// Add additional code 

        

Related Topics

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

General Notices