josh-fell commented on issue #19158:
URL: https://github.com/apache/airflow/issues/19158#issuecomment-949901330


   @pdavis156879 I'm unable to reproduce this with the code provided as well as 
different flavors of calling `macros.ds_add()`. Is there another example you 
have that raises the same exception?
   
   Tested with this DAG:
   ```python
   from datetime import datetime
   
   from airflow.decorators import task
   from airflow.models import DAG
   from airflow.operators.python import PythonOperator
   
   
   def print_dates(execution_date, execution_date_incremented):
       print("----------")
       print("Execution Date:", execution_date)
       print("Execution Date Incremented:", execution_date_incremented)
   
   
   @task(task_id="print_current_date_1")
   def print_dates_1(execution_date, execution_date_incremented):
       print("----------")
       print("Execution Date:", execution_date)
       print("Execution Date Incremented:", execution_date_incremented)
   
   
   @task(task_id="print_current_date_2")
   def print_dates_2(ds=None, macros=None):
       print("----------")
       print("Execution Date:", ds)
       print("Execution Date Incremented:", macros.ds_add(ds, -5))
   
   
   with DAG(
       dag_id="test_dag", schedule_interval="0 * * * *", 
start_date=datetime(2021, 1, 1), catchup=False
   ) as dag:
       start_point = PythonOperator(
           task_id='print_current_date',
           python_callable=print_dates,
           op_kwargs={'execution_date': "{{ ds }}", 
'execution_date_incremented': "{{ macros.ds_add(ds, -5) }}"},
       )
   
       print_dates_1(execution_date="{{ ds }}", execution_date_incremented="{{ 
macros.ds_add(ds, -5) }}")
   
       print_dates_2()
   
   ```
   
   
![image](https://user-images.githubusercontent.com/48934154/138509894-3989d293-329e-4de6-9913-b8b56a04b271.png)
   


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