Recently, I ran into an issue of map-reduce script tasks failing because of an existing map-reduce script deployment running in parallel.
I was triggering the map-reduce script from another script like this:
let createMapReduceTask = task.create({
taskType: task.TaskType.MAP_REDUCE,
scriptId: MAP_REDUCE_SCRIPT_ID,
// deploymentId: MAP_REDUCE_DEPLOY_ID,
params: {
custscript_map_reduce_script: parametr
}
});
I was getting errors initially when this map-reduce was already running in the account, and I tried to execute this again.
To avoid this error, I created multiple deployments of the script and commented the ‘deploymentId’ key in the task.create() function. The map-reduce worked correctly when I triggered it as many times until the total number of deployments.