dstandish commented on code in PR #39336:
URL: https://github.com/apache/airflow/pull/39336#discussion_r1594711540
##########
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:
yeah. @ashb originally i was just deleting _try_number. but the reason we
added that setter is just elasticsearch task handler. there's one code path
where it will set `_try_number` since it's in providers, there will be users
who upgrade airflow without upgrading the provider, and they will hit it.
ideally should not have been referencing _try_number in the first place. (my
mistake actually). so this is just going out of the way to be nice to such
users.
re this ugly compat shim.... we could probably still check by looking at the
object... but i think @jedcunningham's argument was that comparing version is
more explicit / self-documenting, and i think i agree.
--
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]