phanikumv commented on code in PR #68551:
URL: https://github.com/apache/airflow/pull/68551#discussion_r3411143347


##########
providers/standard/src/airflow/providers/standard/decorators/stub.py:
##########
@@ -46,6 +46,16 @@ def __init__(
             task_id=task_id,
             **kwargs,
         )
+        # A retry_policy is user Python evaluated in-process by the task 
runner. Stub tasks
+        # execute on a remote/native worker via the Task Execution Interface 
and never run the
+        # Python task runner, so the policy would silently never fire. Reject 
it up front.
+        # (retries is fine -- the server computes retry eligibility regardless 
of runtime.)
+        if self.retry_policy is not None:

Review Comment:
   ```suggestion
           if getattr(self, "retry_policy", None) is not None:
   ```
   
   attribute doesn't exist on Airflow < 3.3, causes AttributeError on every 
stub task creation on those versions



##########
providers/standard/tests/unit/standard/decorators/test_stub.py:
##########
@@ -55,3 +55,14 @@ def fn_code():
 def test_stub_signature(fn, error):
     with error:
         stub(fn)()
+
+
+def test_stub_rejects_retry_policy():

Review Comment:
   ```suggestion
   from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_3_PLUS
   
   @pytest.mark.skipif(not AIRFLOW_V_3_3_PLUS, reason="retry_policy added in 
Airflow 3.3")
   def test_stub_rejects_retry_policy():
   ```



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