You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/05 19:05:46 UTC

[GitHub] [airflow] turbaszek commented on issue #12577: Use only single execution date in ExternalTaskSensor

turbaszek commented on issue #12577:
URL: https://github.com/apache/airflow/issues/12577#issuecomment-739335720


   @ManiBharataraju I would say that you can do `python_operator >> external_sensor` and pass to the sensor whatever execution date you want. In my opinion this serves 100% of cases. And with TaskFlow API this is dead simple:
   
   ```py
   @task 
   def my_custom_exec_date() -> datetime:
       ctx = get_current_context()
       # here do what you want
       return exec_date
   
   with DAG(...) as dag:
       exec_date = my_custom_exec_date()
       sensor = ExternalTaskSensor(task_id="sensor", execution_date=exec_date)
   ```
   
   If you don't know TaskFlow API:
   - http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/latest/tutorial_taskflow_api.html
   - https://www.polidea.com/blog/airflow-2-0-dag-authoring-redesigned/


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

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