Fixes 18300: Get last completed job run (#18891)

* Get last completed job run

* formatting

---------

Co-authored-by: 😺Leo Luo <leo.luo@mavenclinic.com>
Co-authored-by: Suman Maharana <sumanmaharana786@gmail.com>
This commit is contained in:
LeoLuo123 2024-12-05 05:53:26 -08:00 committed by GitHub
parent 03bd8e9dc4
commit b5750cbee1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -176,7 +176,11 @@ def _(config: DbtCloudConfig): # pylint: disable=too-many-locals
logger.debug(
"Requesting [dbt_catalog], [dbt_manifest] and [dbt_run_results] data"
)
params_data = {"order_by": "-finished_at", "limit": "1"}
params_data = {
"order_by": "-finished_at",
"limit": "1",
"status__in": "[10,20]",
}
if project_id:
params_data["project_id"] = project_id
@ -194,7 +198,7 @@ def _(config: DbtCloudConfig): # pylint: disable=too-many-locals
last_run = runs_data[0]
run_id = last_run["id"]
logger.info(
f"Retrieved last successful run [{str(run_id)}]: "
f"Retrieved last completed run [{str(run_id)}]: "
f"Finished {str(last_run['finished_at_humanized'])} (duration: {str(last_run['duration_humanized'])})"
)
try: