uranusjr commented on issue #20974:
URL: https://github.com/apache/airflow/issues/20974#issuecomment-1586861607

   You can do this instead
   
   ```python
   @task.virtualenv(...)
   def add_days(
       days_to_add: int,  # "Regular" argument.
       data_interval_start=None,  # Automatically populated from context!
   ) -> str:
       return (data_interval_start + timedelta(days=days_to_add)).isoformat()
   
   with DAG(...):
       add_days(10)
   ```
   
   See documentation:
   
   
https://airflow.apache.org/docs/apache-airflow/stable/tutorial/taskflow.html#accessing-context-variables-in-decorated-tasks
   
   Honestly I suspect the pervasive usage ot `**context` is people copy-pasting 
code assuming it’s the only way without ever reading documentation.


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