How to Idenity from REST API whether any jobs running in the Delphix?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered

If you want to create a bookmark from REST API for a TestVDB, at the same time there is a Data Refresh happening for TestVDB in the background, in that case Delphix will not allow to perform the bookmark since there is a job already running. How to identity from REST API interface, is there any job running in the Delphix so that we can wait for some time to perform new operation. Please help.

Photo of Ramesh

Ramesh

  • 518 Points 500 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,418 Points 10k badge 2x thumb
Official Response
Waiting for the job(s): (http://delphixengineip/api/#job)
Take the Job reference (the job number) that you were given and read that object from the Delphix engine:


curl -X GET -k "http://${DEIP}/resources/json/delphix/job/${JOBREF}" -b ~/cookies.txt -H "Content-Type: application/json"


put that will return the job object, which has two properties of interest: jobState and percentComplete


(http://delphixengineip/api/#Job)


The one you want as a condition to evaluate is job_state. So create a polling loop that checks the job to see if it is compeleted.
You can use the percentComplete for informational/logging purposes to track/report job progress.
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,418 Points 10k badge 2x thumb
Official Response
Another thing I commonly do is ensure that no jobs are currently running against the object I want to run against, like in your case.

So, let's just list all jobs that are running against the object that we care about. If none are running, then we can move on. So, I'll use this API call to query all jobs running against the object that are in a state of RUNNING. I will feed that to a loop that keeps checking every few seconds until the list is 0. 

curl -X GET -k "http://${DEIP}/resources/json/delphix/job?target=${OBJREF}&jobState=RUNNING"; -b ~/cookies.txt -H "Content-Type: application/json"