jedcunningham commented on code in PR #30591:
URL: https://github.com/apache/airflow/pull/30591#discussion_r1163412920


##########
docs/apache-airflow/core-concepts/dags.rst:
##########
@@ -448,32 +452,32 @@ You can also combine this with the 
:ref:`concepts:depends-on-past` functionality
         from airflow.models import DAG
         from airflow.operators.empty import EmptyOperator
 
-        dag = DAG(
+        with DAG(
             dag_id="branch_without_trigger",
             schedule="@once",
             start_date=pendulum.datetime(2019, 2, 28, tz="UTC"),
-        )
+        ) as dag:

Review Comment:
   ```suggestion
           ):
   ```
   
   Don't actually need this any longer :)



##########
docs/apache-airflow/core-concepts/dags.rst:
##########
@@ -148,10 +148,14 @@ This means you can define multiple DAGs per Python file, 
or even spread one very
 
 Note, though, that when Airflow comes to load DAGs from a Python file, it will 
only pull any objects at the *top level* that are a DAG instance. For example, 
take this DAG file::
 
-    dag_1 = DAG('this_dag_will_be_discovered')
+    with DAG('this_dag_will_be_discovered') as dag:

Review Comment:
   This whole section is wrong with `auto_register` now :(
   
   Can you refactor this whole section?



##########
docs/apache-airflow/core-concepts/dags.rst:
##########
@@ -648,20 +652,20 @@ This is especially useful if your tasks are built 
dynamically from configuration
     ### My great DAG
     """
     import pendulum
+    from airflow.operators.empty import EmptyOperator
 
-    dag = DAG(
+    with DAG(
         "my_dag",
         start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
         schedule="@daily",
         catchup=False,
-    )
-    dag.doc_md = __doc__
-
-    t = BashOperator("foo", dag=dag)
-    t.doc_md = """\
-    #Title"
-    Here's a [url](www.airbnb.com)
-    """
+        doc_md=__doc__
+    ) as dag:

Review Comment:
   ```suggestion
       ):
   ```



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to