Hi all. How to avoid "Script Execution Time Exceed...
# suitescript
a
Hi all. How to avoid "Script Execution Time Exceeded" error when running a schedule script.
s
monitor the duration your script runs and reschedule it as needed. Or, redesign the script to stop before it runs out of time.
s
Yeah you probably need to build this handling it in yourself, or move whatever you are doing to a map/reduce. If you have a scheduled script processing that much data, M/R is almost always better.
👍 1
👎 1
a
@stalbert the is already rescheduling couple of time base on the remaining usage limit and at some point it is throwing the error. Basically I am trying to assign the resource to the projects and project-tasks. There are 194 projects and each projects has around 44 project tasks. all together I am processing around 8500 records which is taking me around 10-12 hours to finish the schedule script 2.0 execution.
@Sandii Initially I have written map/reduce script and stuck with the error "Script Execution Time Exceeded" error each time i run the script. So I decided to move the script to schedule and now few times the script is running without any errors but most of the time script running is failing due to the time exceeded error.
b
if you are using a schedule script, reschedule more
if you are using map/reduce, break your data into smaller pieces
s
You prob need to break up the handling of the data in the stages better. Each entry of map or reduce have a time limit
a
ok I will try it and see if it works. Thanks @battk and @Sandii
s
map/reduce is not a silver bullet by any means. I wish there wasn't such a tendency to just automatically recommend it as a solution. I continue to reach for a scheduled script first and only do MR if the characteristics of MR are actually needed.
b
a cheap way to reschedule more is to reschedule at a lower point limit
a more proper way is to keep track of how long the script has run and reschedule after a certain amount of time has passed
s
@Arun Dasari when checking governance usage, you can also check clock time usage as well. For example: https://github.com/ExploreConsulting/netsuite-fasttrack-toolkit-ss2/blob/58ee5d0291c9cafce8703fa396b6d937ffdd2738/governance.ts#L17
(you could also grab the `rescheduleIfNeeded'`function too)
a
Thanks @stalbert and @battk
@stalbert or @battk The script is talking around 10-12
hours to process around 8500 records as i mentioned previous when assigning resources to project and projecttasks
Why was it talking too long time to process just 8500 records ??
b
thats more of a question for you than us
has a lot more to do with what your script does, what customizations are in place, and what service tier you are on
even the timezone of the account matters, scripts during peak hours are slowed than off peak
s
if your problem is embarrassingly parallel then you might consider switching to M/R. However, I'd take a close look at improving the script efficiency. Just blindly converting to M/R would likely retain inefficiency
s
Yep swapping to MR wont fix inefficient logic but it will avoid overall script timeout if you are doing the same thing over and over (which it what it sounds most likely to be)