in data-mesh-banking-labs/setup/resources/composer/dags/create_merchants_data_exchange_tag.py [0:0]
def get_clouddq_task_status(task_id):
"""
This method will return the job status for the task.
Args:
Returns: str
"""
session, headers = get_session_headers()
res = session.get(
f"{DATAPLEX_ENDPOINT}/v1/projects/{PROJECT_ID_DG}/locations/{DATAPLEX_REGION}/lakes/{LAKE_ID}/tasks/{task_id}/jobs", headers=headers)
print(res.status_code)
print(res.text)
resp_obj = json.loads(res.text)
if res.status_code == 200:
if (
"jobs" in resp_obj
and len(resp_obj["jobs"]) > 0
and "state" in resp_obj["jobs"][0]
):
task_status = resp_obj["jobs"][0]["state"]
return task_status
else:
return "FAILED"