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


##########
airflow/models/taskinstance.py:
##########
@@ -1549,53 +1519,22 @@ def init_on_load(self) -> None:
         """Initialize the attributes that aren't stored in the DB."""
         self.test_mode = False  # can be changed when calling 'run'
 
-    @hybrid_property
-    def try_number(self):
-        """
-        Return the try number that a task number will be when it is actually 
run.
-
-        If the TaskInstance is currently running, this will match the column 
in the
-        database, in all other cases this will be incremented.
-
-        This is designed so that task logs end up in the right file.
-        """
-        return _get_try_number(task_instance=self)
-
-    @try_number.expression
-    def try_number(cls):
-        """
-        Return the expression to be used by SQLAlchemy when filtering on 
try_number.
-
-        This is required because the override in the get_try_number function 
causes
-        try_number values to be off by one when listing tasks in the UI.
-
-        :meta private:
-        """
-        return cls._try_number
-
-    @try_number.setter
-    def try_number(self, value: int) -> None:
-        """
-        Set a task try number.
-
-        :param value: the try number
-        """
-        _set_try_number(task_instance=self, value=value)
-
     @property
+    @deprecated(reason="Use try_number instead.", version="2.10.0", 
category=RemovedInAirflow3Warning)
     def prev_attempted_tries(self) -> int:
         """
-        Calculate the number of previously attempted tries, defaulting to 0.
+        Calculate the total number of attempted tries, defaulting to 0.
+
+        This used to be necessary because try_number did not always tell the 
truth.
 
-        Expose this for the Task Tries and Gantt graph views.
-        Using `try_number` throws off the counts for non-running tasks.
-        Also useful in error logging contexts to get the try number for the 
last try that was attempted.
+        :meta private:
         """
-        return self._try_number
+        return self.try_number
 
     @property
     def next_try_number(self) -> int:
-        return self._try_number + 1
+        # todo (dstandish): deprecate this property; we don't need a property 
that is just + 1

Review Comment:
   leaving that for the future @jedcunningham . it's got some other sequelae so 
i considered it out of scope



-- 
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]

Reply via email to