You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Li Xuanji (JIRA)" <ji...@apache.org> on 2016/08/18 19:58:20 UTC

[jira] [Created] (AIRFLOW-443) Code from DAGs with same __name__ show up on each other's code view in the web UI

Li Xuanji created AIRFLOW-443:
---------------------------------

             Summary: Code from DAGs with same __name__ show up on each other's code view in the web UI
                 Key: AIRFLOW-443
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-443
             Project: Apache Airflow
          Issue Type: Bug
            Reporter: Li Xuanji
            Assignee: Li Xuanji


With a dags folder containing 2 files, `bash_bash_bash/dag.py` and `bash_bash_bash_2/dag.py`, with the following contents

bash_bash_bash/dag.py
```
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2016, 1, 1, 1, 0),
    'email': ['xuanji@gmail.com'],
    'email_on_failure': True,
    'email_on_retry': False,
    'retries': 3,
    'retry_delay': timedelta(minutes=1),
    'concurrency': 1,
}

dag = DAG('bash_bash_bash', default_args=default_args, schedule_interval=timedelta(seconds=10))

# t1, t2 and t3 are examples of tasks created by instatiating operators
t1 = BashOperator(
    task_id='print_date',
    bash_command='date',
    dag=dag
)

t2 = BashOperator(
    task_id='sleep',
    bash_command='sleep 1',
    retries=3,
    dag=dag
)

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',
    bash_command=templated_command,
    params={'my_param': 'Parameter I passed in'},
    dag=dag
)

t2.set_upstream(t1)
t3.set_upstream(t1)
```

bash_bash_bash_2/dag.py
```
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2016, 1, 1, 1, 0),
    'email': ['xuanji@gmail.com'],
    'email_on_failure': True,
    'email_on_retry': False,
    'retries': 3,
    'retry_delay': timedelta(minutes=1),
    'concurrency': 1,
}

dag = DAG('bash_bash_bash_2', default_args=default_args, schedule_interval=timedelta(seconds=10))

t1 = BashOperator(
    task_id='print_date',
    bash_command='date',
    dag=dag
)
```

The code view in the web UI shows the contents of bash_bash_bash_2/dag.py  for both DAGs



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)