-
Notifications
You must be signed in to change notification settings - Fork 5
REST firekue
The /firekue
REST service lets you queue jobs for batch and/or steppable interactive execution.
FireKue adopts a subset of the REST protocols provided by kue.
FireKue also has REST protocols for steppable execution that allow users to single-step
firenodejs jobs or simply execute them automatically.
A job is a JSON object with the following fields:
attribute | description |
---|---|
id | a monotonic increasing integer provided by FireKue itself on when a job is added to the queue. |
type | job type (e.g., 'REST') |
state | Jobs can be inactive:pending execution; active:executing; complete:done successfully; failed:terminated with errors |
data | data semantics depend on job type. For REST jobs, this will be an array of REST requests |
result | result semantics depend on job type. For REST jobs, this will be an array of HTTP REST responses |
progress | provided by FireKue, progress is a number between 0 and 1. Jobs are done (i.e., complete or failed) when progress is 1. |
tStart | time when job started |
tEnd | time when job ended |
isBusy | true indicates that queue has more steps to be executed |
err | Error object or null |
The FireKue architecture supports multiple workers:
- each worker supports one or more job types
- workers serialize execution and run one job at a time, step-by-step
The following REST commands may fail with HTTP501 if the designated camera is not available.
Add a job to the queue.
Return job with given id.
Delete job with given id.
Return ordered array of job ids in the interval [from..to] with given job type and job state.
Execute a single job step:
- assign jobs to idle workers
- step each non-idle worker
Returns queue execution status upon step completion:
{
"progress": 1,
"isBusy": false,
"err": null,
}
The following URLs are reserved for future use as REST protocols
- TBD
You can upload REST jobs using a shell script. To upload the testjob.jsono do this:
scripts/addjob.sh -h localhost json/testjob.json
Once jobs are uploaded, you can execute them one step at a time:
scripts/stepjob.sh -h raspberrypi -p 8080
Or you can run all jobs till complete
scripts/stepjob.sh -h raspberrypi -p 8080 -a