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 2021/11/05 14:38:17 UTC

[GitHub] [airflow] eladkal commented on issue #8006: Error out when timezone is not supplied with pendulum

eladkal commented on issue #8006:
URL: https://github.com/apache/airflow/issues/8006#issuecomment-961948121


   To my understanding the issue here is that the broken DAG message was not present in the UI and you had trouble to find that the DAG has code problems which is why it was never executed as expected.
   
   I can confirm that this is no longer the case and in Main branch the code you shared raise broken DAG message:
   
   ![Screen Shot 2021-11-05 at 16 36 52](https://user-images.githubusercontent.com/45845474/140527882-b9ebd722-b3d9-4abf-8309-badf9a1b560a.png)
   
   
   As for your question about support for `dateutil.tz` the [documentation](https://airflow.apache.org/docs/apache-airflow/stable/timezone.html#time-zone-aware-dags) states:
    
   Just make sure to supply a time zone aware start_date using pendulum
   
   The modified code after fixing according to the documentation executed just fine:
   ```
   
   from datetime import datetime, timedelta
   
   import pendulum
   
   from airflow import DAG
   from airflow.operators.bash import BashOperator
   
   BG_TZ = pendulum.timezone('Europe/Sofia')
   DEFAULT_ARGS = {
       "owner": "airflow",
       "start_date": datetime(2020, 3, 28, tzinfo=BG_TZ),
       "email_on_failure": False,
       "email_on_retry": False,
       "retries": 0,
       "retry_delay": timedelta(minutes=5),
   }
   
   with DAG(
       'test_dag',
       default_args=DEFAULT_ARGS,
       schedule_interval='0,30 * * * *',
       catchup=False,
   ) as test_dag:
   
       t1 = BashOperator(
           task_id="ok",
           bash_command="date -Is; echo ok",
       )
   
   ```
   
   ![Screen Shot 2021-11-05 at 16 35 35](https://user-images.githubusercontent.com/45845474/140527677-dcaff5b0-0d95-416d-95ef-f53b195c962d.png)
   
   
   Closing as no issue to fix here.


-- 
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: commits-unsubscribe@airflow.apache.org

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