amoghrajesh commented on code in PR #76718: URL: https://github.com/apache/airflow/pull/76718#discussion_r4520413773
########## providers/databricks/src/airflow/providers/databricks/operators/databricks.py: ########## @@ -82,6 +83,19 @@ XCOM_RUN_PAGE_URL_KEY = "run_page_url" XCOM_STATEMENT_ID_KEY = "statement_id" +# jobs/runs/get answers 400 INVALID_PARAMETER_VALUE for a run it no longer knows about, never 404. +# These are the two message forms the Databricks SDK overrides to ResourceDoesNotExist; the code +# alone also covers malformed input, which must stay an error rather than trigger a resubmit. +_RUN_MISSING_MESSAGE_PATTERN = re.compile(r"Run .* does not exist|Run: .* in job: .* doesn't exist") + + +def is_run_missing_error(exc: DatabricksApiError) -> bool: Review Comment: Renamed to _is_run_missing_error. The async point is right: `_a_do_api_call` builds the error from `aiohttp.ClientResponseError` and never sets `error_code`, so this only works on sync errors. ########## providers/databricks/src/airflow/providers/databricks/operators/databricks.py: ########## @@ -82,6 +83,19 @@ XCOM_RUN_PAGE_URL_KEY = "run_page_url" XCOM_STATEMENT_ID_KEY = "statement_id" +# jobs/runs/get answers 400 INVALID_PARAMETER_VALUE for a run it no longer knows about, never 404. +# These are the two message forms the Databricks SDK overrides to ResourceDoesNotExist; the code +# alone also covers malformed input, which must stay an error rather than trigger a resubmit. +_RUN_MISSING_MESSAGE_PATTERN = re.compile(r"Run .* does not exist|Run: .* in job: .* doesn't exist") + + +def is_run_missing_error(exc: DatabricksApiError) -> bool: + """Whether ``exc`` means Databricks has no record of the run (expired, deleted, or foreign).""" + if exc.http_status_code == 404 or exc.error_code == "RESOURCE_DOES_NOT_EXIST": Review Comment: Removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
