PrarthiJain opened a new issue #14584:
URL: https://github.com/apache/airflow/issues/14584


   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the 
following questions.
   Don't worry if they're not all applicable; just try to include what you can 
:-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   <!--
   
   IMPORTANT!!!
   
   PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
   NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
   
   PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
   
   Please complete the next sections or the issue will be closed.
   These questions are the first thing we need to know to understand the 
context.
   
   -->
   
   **Apache Airflow version**:
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**:
   - **OS** (e.g. from /etc/os-release):
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   
   <!-- (please include exact error messages if you can) -->
   
   **What you expected to happen**:
   
   <!-- What do you think went wrong? -->
   
   **How to reproduce it**:
   <!---
   
   As minimally and precisely as possible. Keep in mind we do not have access 
to your cluster or dags.
   
   If you are using kubernetes, please attempt to recreate the issue using 
minikube or kind.
   
   ## Install minikube/kind
   
   - Minikube https://minikube.sigs.k8s.io/docs/start/
   - Kind https://kind.sigs.k8s.io/docs/user/quick-start/
   
   If this is a UI bug, please provide a screenshot of the bug or a link to a 
youtube video of the bug in action
   
   You can include images using the .md style of
   ![alt text](http://url/to/img.png)
   
   To record a screencast, mac users can use QuickTime and then create an 
unlisted youtube video with the resulting .mov file.
   
   --->
   
   
   **Anything else we need to know**:
   
   <!--
   
   How often does this problem occur? Once? Every time etc?
   
   Any relevant logs to include? Put them here in side a detail tag:
   <details><summary>x.log</summary> lots of stuff </details>
   
   -->
   Bug-
   
   When 'start_date': timezone.utcnow() is passed in default_args dictionary, 
the DAG is not being executed since “The execution_date>=start_date from DAG 
default_args,” but when the corresponding start date is passed at task 
level(DAG level parameters), the airflow UI reports it as ’success’ when 
externally triggered. (Screenshot attached.)
   
    
   
   Expected-
   
   **Manual triggering should not be executed and should behave the same as 
passed in default_args
   
    
   
   DAG example code-
   
    
   
   from datetime import timedelta
   from airflow import DAG
   from airflow.utils import timezone
   from datetime import datetime
   from airflow.operators.bash_operator import BashOperator
   from airflow.utils.dates import days_ago
   default_args = {
       'owner': 'airflow',
       'depends_on_past': False,
       'retries': 1,
       'retry_delay': timedelta(minutes=5),
   }
   dag = DAG(
       'DAG-start_date',
       default_args=default_args,
       description='A simple tutorial DAG',
       schedule_interval=timedelta(days=1),
       start_date = timezone.utcnow(),
       tags=['example'],
       is_paused_upon_creation = False
   )
   t1 = BashOperator(
       task_id='print_date',
       bash_command='date',
       dag=dag,
   )
    
   t2 = BashOperator(
       task_id='sleep',
       depends_on_past=False,
       bash_command='sleep 5',
       retries=3,
       dag=dag,
   )
   dag.doc_md = __doc__
    
   t1.doc_md = ""
   templated_command = """
   {% for i in range(5) %}
       echo "{{ ds }}"
       echo "{{ macros.ds_add(ds, 7)}}"
       echo "{{ params.my_param }}"
   {% endfor %}
   """
    
   t3 = BashOperator(
       task_id='templated',
       depends_on_past=False,
       bash_command=templated_command,
       params={'my_param': 'Parameter I passed in'},
       dag=dag,
   )
    
   t1 >> [t2, t3]
    
   
   Log-
   
   AIRFLOW_CTX_DAG_RUN_ID=manual__2021-03-03T14:55:35.896567+00:00
   [2021-03-03 20:25:37,111] {bash.py:135} INFO - Tmp dir root location:
   /var/folders/nl/v9xl69s13k57smt_g1l9zrx40000gn/T
   [2021-03-03 20:25:37,112] {bash.py:158} INFO - Running command: date
   [2021-03-03 20:25:37,117] {bash.py:169} INFO - Output:
   [2021-03-03 20:25:37,123] {bash.py:173} INFO - Wed Mar  3 20:25:37 IST 2021
   [2021-03-03 20:25:37,123] {bash.py:177} INFO - Command exited with return 
code 0
   [2021-03-03 20:25:37,135] {taskinstance.py:1159} INFO - Marking task as 
SUCCESS. dag_id=tutorial-2, task_id=print_date, execution_date=20210303T145535, 
start_date=20210303T145537, end_date=20210303T145537
   [2021-03-03 20:25:37,147] {taskinstance.py:1220} INFO - 2 downstream tasks 
scheduled from follow-on schedule check
   [2021-03-03 20:25:37,162] {local_task_job.py:146} INFO - Task exited with 
return code 0
    


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


Reply via email to