You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2024/05/08 20:59:15 UTC

Re: [PR] Scheduler to handle incrementing of try_number [airflow]

ashb commented on code in PR #39336:
URL: https://github.com/apache/airflow/pull/39336#discussion_r1594657364


##########
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:
   I don't love this, but other than deleting the `_try_number` property (and using that to detect the older version, possibly breaking back compat) I don't have any other ideas.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org