chetratep commented on issue #7852: airflow 1.10.9 can't stop backfilling and 
timezone issue 
URL: https://github.com/apache/airflow/issues/7852#issuecomment-603779967
 
 
   The **defalut_timezone** in **airflow.cfg** does not make the dag timezone 
aware until it we directly set the **start_date** with timezone. 
   I tried the following
   
   ```
   from builtins import range
   from datetime import timedelta
   import pendulum
   
   import airflow
   from airflow.models import DAG
   from airflow.operators.bash_operator import BashOperator
   from airflow.operators.dummy_operator import DummyOperator
   local_tz = pendulum.timezone("Asia/Tokyo")
   pnow = pendulum.now('Asia/Tokyo')
   
   args = {
       'owner': 'airflow',
       'start_date': pnow.subtract(hours=36),
       'depends_on_past': False,
   }
   
   dag = DAG(
       dag_id='OOM_test',
       catchup=False,
       default_args=args,
       schedule_interval='40 10 * * *',
       dagrun_timeout=timedelta(minutes=60),
   )
   
   # [START task]
   oom_test = BashOperator(
       task_id='oom_test',
       bash_command='python /home/tmail/work/scheduler/testOOM.py > /dev/null 
2>&1 ',
       dag=dag,
   )
   print("Dag: {} TimeZone: {}".format(dag.dag_id, dag.timezone))
   oom_test
   
   ```
   **pnow.subtract(hours=36)** stops the task from executing immediately after 
enable it on UI.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to