WORKFLOW-199: polling every X seconds for job completion #138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the ability to pass new parameters to
POST /jobs
when creating a new job via the apiwait
: set this totrue
to have thePOST
request block while the job completescallback_urls
: an optional array of endpoints to call, by the runner, when a job completes.A caller of the api service can create a job like this now
where
wait
tells the API to return the headers immediately (containing the same headers thatPOST /jobs
would normally give), but to wait until the job has completed to return the body. The body of the request will be the same body that would be supplied byGET /jobs/:uuid
... ie. it will be a JSON body that gives the exit status of the job (completed, failed, etc.)callback_urls
should contain a URL to hit the api service (the runner calls the urls incallback_urls
) at the endpoint/jobdone
, which is a new endpoint for the API service that takes aPOST
request with the output of a job, and uses that to end any requests that are currently waiting.todo
restify
(if it makes sense)caveats
wait: true
without registering the API service as acallback_url
will result in the request hanging indefinitely