ashb commented on code in PR #39336:
URL: https://github.com/apache/airflow/pull/39336#discussion_r1594684024
##########
airflow/providers/dbt/cloud/utils/openlineage.py:
##########
@@ -21,13 +21,25 @@
from contextlib import suppress
from typing import TYPE_CHECKING
+from airflow import __version__ as airflow_version
+
if TYPE_CHECKING:
from airflow.models.taskinstance import TaskInstance
from airflow.providers.dbt.cloud.operators.dbt import
DbtCloudRunJobOperator
from airflow.providers.dbt.cloud.sensors.dbt import DbtCloudJobRunSensor
from airflow.providers.openlineage.extractors.base import OperatorLineage
+def _get_try_number(val):
+ # todo: remove when min airflow version >= 2.10.0
+ from packaging.version import parse
+
+ if parse(parse(airflow_version).base_version) < parse("2.10.0"):
+ return val.try_number - 1
+ else:
+ return val.try_number
Review Comment:
That's what this is currently doing, `ti._try_number` is currently raising
the deprecation warning. But that means we can't use `if hasattr(val,
"_try_number")` as a way of detecting the old version, cos we've done the
"right" thing.
--
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]