What's the difference between Cloud Function and Cloud Job?

Parse docs says I should use Cloud Jobs when I wanna perform a long task.

But why? Cloud code doesn’t have a timeout and it can do long jobs. Why I should use Jobs over cloud code?

Does jobs consume less resource without blocking future requests? What are the advantages of Jobs?

In my case, I do some long operation in afterSave or afterDelete operation. For example I delete related objects in afterDelete.

1 Like

Cloud Function: designed to be run via code, in your apps and execute complex business logic for your users. It’s a custom endpoint dedicated to your users

Cloud Job: An internal task, only runnable by master key. Mainly used to execute some migrations or in developpment to create some tests data etc… It’s a maintenance endpoint dedicated to developers not users.

2 Likes

Another difference maybe worth mentioning is that Cloud Jobs have a historic status log where you can see how jobs executed and you can write custom status messages to that log.

For example, if you want to run a periodic clean-up task every hour in your production environment, you can use the Parse Dashboard to look into the status of each of these job executions, whether they were successful, how many items were cleaned up and whatever you may want to write into the status log.

Since Cloud Jobs were originally designed to also run periodically, Parse Dashboard offers an interface to set-up scheduled jobs that run for example every 5 minutes, once a day, every Monday, etc.

Cloud Code does not offer such a built-in status log or scheduling interface.

3 Likes

I didnt know that. I was using cron jobs. But if Cloud Jobs have this feature, I will use it

I should clarify that Parse Dashboard provides the interface, not the runner to execute the scheduled job. For example, see here for more details.