You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Headers from the request that triggered the job
145
+
var headers =request.headers;
146
+
147
+
// get the parse-server logger
148
+
var log =request.log;
149
+
150
+
// Update the Job status message
151
+
status.message("I just started");
152
+
doSomethingVeryLong().then(function(result) {
153
+
// Mark the job as successful
154
+
// success and error only support string as parameters
155
+
status.success("I just finished");
156
+
}, function(error) {
157
+
// Mark the job as errored
158
+
status.error("There was an error");
159
+
})
160
+
});
161
+
```
162
+
163
+
Note that calling `status.success` or `status.error` won't prevent any further execution of the job.
164
+
165
+
## Running a Job
166
+
167
+
Calling jobs is done via the REST API and is protected by the master key.
168
+
169
+
```sh
170
+
curl -X POST -H 'X-Parse-Application-Id: appId' -H 'X-Parse-Master-Key: masterKey' https://my-parse-server.com/1/jobs/myJob
171
+
```
172
+
173
+
The response will consist of an empty body and contain the `X-Parse-Job-Status-Id: a1c3e5g7i9k` header. With the _JobStatus's objectId that has just been created.
174
+
175
+
You can pass some data alongside the call if you want to customize the job execution.
176
+
177
+
## Scheduling a Job
178
+
179
+
We don't support at the moment job scheduling and highly recommend to use a 3rd party system for scheduling your jobs.
180
+
181
+
- On [AWS Elastic Beanstalk](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html#worker-periodictasks)
182
+
- On [Google App Engine](https://cloud.google.com/appengine/docs/flexible/nodejs/scheduling-jobs-with-cron-yaml)
183
+
- On [Heroku](https://devcenter.heroku.com/articles/scheduler#scheduling-jobs)
184
+
185
+
## Viewing Jobs
186
+
187
+
Viewing jobs is currently not supported on parse-dashboard, but you can query the _JobStatus class with a masterKey call to fetch your recent jobs.
0 commit comments