API/Python/Open-Source Solutions

Expand all | Collapse all

Is there a way to determine if there is a job running in a jetstream container?

Jump to Best Answer

Jim Daniels09-27-2016 04:14:00 PM

Jim Daniels09-27-2016 04:16:00 PM

  • 1.  Is there a way to determine if there is a job running in a jetstream container?

    Posted 09-27-2016 04:14:00 PM


  • 2.  RE: Is there a way to determine if there is a job running in a jetstream container?

    Posted 09-27-2016 04:16:00 PM
    Via API?


  • 3.  RE: Is there a way to determine if there is a job running in a jetstream container?
    Best Answer

    Posted 09-27-2016 04:21:00 PM
    Sure. I do simple checks like that in my automation. Take a look at this shell function that I wrote that takes a reference id (all delphix objects have one) and waits for the jobs to complete.

    function RUNNING_JOBS_WAIT { #This function wais for jobs to finish on the specified target
    #Takes one parameter: The target reference
    TARGETREF=$1
    until [[ 1 -gt 2 ]]; do
    fJOB=$(curl -X GET -k "http://${DEIP}/resources/json/delphix/job?target=${TARGETREF}&jobState=RUNNING"; \
    -b ~/cookies.txt -H "Content-Type: application/json"| jq -r ".result[].reference")
    if [[ -n ${fJOB} ]]; then
    echo "Waiting on $fJOB to complete"
    sleep 5
    else
    break
    fi
    done
    echo "Job's done"
    }