If I want to execute below shell commands from Python (through API call) , how can I do that ?
AUTH_TOKEN=$(gcloud auth print-access-token)
CDAP_ENDPOINT=$(gcloud beta data-fusion instances describe \
--location=${CDF_REGION} \
--format="value(apiEndpoint)" \
${CDF_INSTANCE_ID})
WF_URL="${CDAP_ENDPOINT}/v3/namespaces/default/apps"
WF_URL=${WF_URL}/${CDF_PIPELINE}/workflows/DataPipelineWorkflow
RUN_IDS=`curl -s -X GET \
-H "Authorization: Bearer ${AUTH_TOKEN}" \
"${WF_URL}/runs" \
| jq -r '.[].runid'`
RUN_DETAILS=`curl -s -X GET \
-H "Authorization: Bearer ${AUTH_TOKEN}" \
"${WF_URL}/runs/${RUN_ID}" \
| jq -r '.runid, .starting, .start, .end, .status'`
Regards, Santanu
See code implementation below for your use case.
Test run: