Map/Reduce Script Error Handling

A map/reduce script can be interrupted by either of the following:

Interruptions can leave portions of a script’s work incomplete. However, the system includes measures for dealing with this problem.

After an application-server disruption, the system automatically restarts the script, regardless of which stage was in progress when the failure occurred. For example, if the failure occurred during the map or reduce stage, the map or reduce job restarts. In this case, the default behavior is that the restarted job invokes the map or reduce function again for all key-value pairs that were previously flagged for processing but not yet marked complete. This behavior can be modified by using the retryCount option.

After an uncaught error is thrown, the behavior varies depending on the stage. If the error is thrown during the getInputData stage, the script goes immediately to the summarize stage, and the getInputData stage is not restarted. If an uncaught error is thrown during the map or reduce stage, the default behavior is that the current function invocation ends, even if incomplete, and the map or reduce job moves on to other key-value pairs that require processing. However, the script can be configured so that the map or reduce function is invoked again for the pair that was being processed when the error occurred. You manage the system’s behavior in this case by using the retryCount and exitOnError options.

To fully understand the system response to interruptions, see System Response After a Map/Reduce Interruption.

In general, your script should include logic that checks to see whether a restart has occurred. If the function has been restarted, the script should take any actions needed to avoid unwanted duplicate processing. For more information, see Adding Logic to Handle Map/Reduce Restarts.

For additional explanation of how each stage responds to a restart, see Execution of Restarted Map/Reduce Stages.

Related Topics

SuiteScript 2.x Map/Reduce Script Reference
Map/Reduce Terminology
Map/Reduce Script Stages
Map/Reduce Yielding
Map/Reduce Script Submission
Map/Reduce Governance
Map/Reduce Script Status Page
Map/Reduce Script Testing and Troubleshooting

General Notices