Map Reduce Error Handling

Jira Code: TRS-579

The main use of map-reduce script to process bulk data and update NetSuite. We can trigger Map-reduce by submitting the task inside the script, but it will never return any data or error message once it completed.
If any of the reduce(stage in map-reduce script) becomes fails we can create a text/CSV in NS file cabinet which contain error message and reduce parameters. So for each reduces stage, it executes the same.
In summarize, we can concatenate each generated file cabinet and will send a mail. Using this method users get notified by the map-reduce completion status and error if any.
After sending the status email, generated error files should be deleted

 
 var errorFileContent = (dataObj.fundName) + '    ' + error;              
  var errorFileId = errorHandle.generateErrorFile(errorFileName, errorFileContent, errorFolderId);

generateErrorFile: function(fileName, fileContent, parent) {

                var csvFile = file.create({ name: fileName, fileType: file.Type.CSV, contents: fileContent, folder: parent, });

                var csvFileID = csvFile.save();

                return csvFileID;

            },

Leave a comment

Your email address will not be published. Required fields are marked *