My application is using the POST method to submit jobs remotely. After submitting a job, I receive a unique job ID from the POST request that allows me to check the status of the job using a GET request.
$http.get('http://localhost:8090/jobs/'+id).then(function successCallback(results) {
jobResults = results;
}
The issue I am facing is that I want to assign the variable once the job is completed, and not right at the beginning. Is there a way to achieve this?
If the job is successfully finished, the results will be displayed like this:
{
"duration": "0.171 secs",
"classPath": "spark.jobserver.WordCountExample",
"startTime": "2017-02-17T22:47:49.291Z",
"context": "c4c62dd3-spark.jobserver.WordCountExample",
"result": {
"word1": 1,
"word2": 3
},
"status": "FINISHED",
"jobId": "994569f9-b6a5-40d3-a4b3-f281276c6716"
}
The only visible difference if the job is not yet completed is that the "result" variable will be absent in the response.