MapReduceScriptTask.submit()

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Submits a map/reduce script deployment for processing.

For more information, see task.MapReduceScriptTask.

Additionally, note that a map/reduce script can be submitted for processing only if there is no unfinished map/reduce script task for the same script ID and script deployment ID. For this reason, if a map/reduce script resubmits itself, the resubmit does not occur until the current execution completes. This delay is necessary to avoid the existence of two unfinished tasks for the same deployment of the same script. Therefore, if a map/reduce script uses the submit() method to resubmit itself, then at runtime, no task ID is returned when the map/reduce script is submitted. If submitted scheduled scripts are requested at the same time or rapidly in succession, the scheduled tasks may not proceed to the Queued status and must resubmit if fails.

Note:

This method will ad-hoc start the Map/Reduce deployment with the identity/role being inherited from the script that called the method. Executing a map/reduce script from a server script requires either the Administrator role or a role with the SuiteScript and SuiteScript Scheduling permissions. For more information, see Permissions Documentation.

For general information about the execution of map/reduce scripts, see Map/Reduce Script Submission.

Returns

string

The task ID, except as noted above.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

20 units

Module

N/task Module

Since

2015.2

Errors

Error Code

Message

Thrown If

FAILED_TO_SUBMIT_JOB_REQUEST_1

Failed to submit job request: {reason}

Task cannot be submitted.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/task Module Script Samples.

          //Add additional code 
...
var mrTaskId = mrTask.submit();
...
//Add additional code 

        
Note:

For general information about map/reduce scripts, see SuiteScript 2.x Map/Reduce Script Type.

Related Topics

task.MapReduceScriptTask
N/task Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices