Processor intensive Task

Hey Guys,

we have a buisiness requirement invloving running a long task in erpnext which may take anywhere from 20~30 minutes to a couple of hours to finish

of course i can’t have this task run in the UI during saving

my question is that is it a good idea to use scheduled events in the hooks.py file for this??

won’t this long task block other important things like emails and notifications and other background tasks?

is there any alternative to scheduled events for such tasks?

I think it would be better to use a background task as that will not block. In your UI, simply notify the user about the long process. Don’t forget to set a long enough timeout

1 Like

thanks a lot, i have decided to use scheduled events and i will try to divide the problem over several runs, any idea on how to set the timeout for a scheduled task??

https://frappe.io/docs/user/en/guides/app-development/running-background-jobs

Default on the long_job queue is 25 mins I believe. I don’t know if there is any way to extend it. If there isn’t a way to extend it, you may have to setup your own queue with longer timeouts.

2 Likes