-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Support job on cloudcode #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is pretty cool, but a few requests: Support the original definition signature of a cloud job: Maybe the scheduler/start stuff could be simplified and added under Thoughts? |
@gfosco let's wait for the multiple apps support to cook that in as the whole thing will need a revamp anyway. |
@shoe116 also we need to take into account the different environments. For heroku that's gonna be a worker, GAE has it's cron API too, I believe AWS beanstalk has a worker class too. |
@shoe116 updated the pull request. |
@gfosco Thank you for some good advice and sorry for late reply. OK, I will try adding new patch for this pull request. @flovilmart GAE support is very useful, but it should be new issue and patch I think. |
@shoe116 What i mean by that, is that depending where you deploy you may not have a cron that work properly. So to avoid a full rewrite when a new 'adapter/provider' is implemented, we may want to abstract that right away. |
@shoe116 updated the pull request. |
Which file would I put this code in:
Is it the index.js file or main.js file? Is it something new I have to create? I'm using a heroku server in case you wanted to know: #668 |
success: (message) => {console.log(message)}, | ||
error: (message) => {console.error(message)} | ||
} | ||
this.jobs[name] = function(){Parse.Cloud.Functions[name](req, res);}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That won't work with the new architecture
@shoe116 I believe it should be overhauled for now as the Parse.Cloud.Functions don't exist anymore. WE store everything through the triggers.js architecture. What I suggest to move forward: in
Add a job endpoint: https://www.parse.com/docs/rest/guide#cloud-code-background-jobs That will make it easy to configure the jobs externally, from any client that has a masterKey. You should log the job results, runs etc... into a _Jobs raw data store, this way we'll have the jobs history. |
@flovilmart Ok, I'll try to overhauled for my implementing. Thank you for your kind review. |
@shoe116 @flovilmart is this still being worked upon? Jobs seems like the only major feature left now. |
@gimdongwoo @shoe116 @flovilmart This seems really useful. Has anyone rolled in a (background) jobs-related change into master? |
I don't see real benefits in including them into parse-server, and they are a pain to scale as soon as you have multiple instances. Also note that there are plenty of solutions available out there to run scheduled jobs. And cloud functions expose a nice http URL to the outside world. |
@sprabs It need to big codes. |
What we can do is create a /job/:jobName alias, protected by a job key or the webhooks key. So they're not accessible as functions |
Parse.com supported the cloud code as cron or job scheduler but parse-servier does not implement this feather.
https://parse.com/docs/server/guide#migrating
This patch makes parse-server support cron job.
If you has this job on cloud code
write
on parse-server.