API/Python/Open-Source Solutions

Expand all | Collapse all

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

Jump to Best Answer
  • 1.  How to Idenity from REST API whether any jobs running in the Delphix?

    Posted 05-03-2016 09:12:00 AM

    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.


    #DemoEnvironment
    #Tip


  • 2.  RE: How to Idenity from REST API whether any jobs running in the Delphix?
    Best Answer

    Posted 05-03-2016 09:14:00 AM
    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.




  • 3.  RE: How to Idenity from REST API whether any jobs running in the Delphix?
    Best Answer

    Posted 05-03-2016 09:21:00 AM
    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"">http://${DEIP}/resources/json/delphix/job?target=${OBJREF}&jobState=RUNNING"">http://${DEIP}/resources/json/delphix/job?target=${OBJREF}&jobState=RUNNING"; -b ~/cookies.txt -H "Content-Type: application/json"