You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Tao Feng (JIRA)" <ji...@apache.org> on 2019/01/16 22:39:00 UTC

[jira] [Commented] (AIRFLOW-3717) Refactor sample DAGs to use context manager

    [ https://issues.apache.org/jira/browse/AIRFLOW-3717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16744515#comment-16744515 ] 

Tao Feng commented on AIRFLOW-3717:
-----------------------------------

Thanks [~SteveGreenberg] , agree we should encourage to use context manager to write DAG. Feel free to submit a pr to fix it.

> Refactor sample DAGs to use context manager
> -------------------------------------------
>
>                 Key: AIRFLOW-3717
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3717
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Steve Greenberg
>            Priority: Minor
>
> Tutorial code says: 
>  
> ```
> import airflow
> from airflow import DAG
>  
> dag = DAG(
> ...
> ```
>  
> The context manager saves users the need to pass the dag parameter to each operator. 
>  
> So we should encourage: 
>  
> ```
> from airflow import models
>  
> with models.DAG(
> ...
> ```
> instead.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)