josh-fell commented on pull request #18278:
URL: https://github.com/apache/airflow/pull/18278#issuecomment-924944739


   
   
   
   > Just thinking if we should show an example of using `@dag.task`?
   > 
   > ```python
   > dag = DAG('dag_id')
   > 
   > @dag.task
   > def mytask():
   >     print('something')
   > ```
   > 
   > WDYT @josh-fell
   
   The `example_kylin_dag` and `example_sqlite` DAG are both using this syntax 
(with the latter even showing passing `task_id` to the decorator which has come 
up several times in StackOverflow and Slack). For the core Airflow example DAGs 
-- that I'm also working on updating -- there doesn't seem to any existing 
non-context manager `DAG()` instantiations. However, I feel like this syntax 
should be in the Concepts/TaskFlow documentation as an explicit option for 
folks to declare tasks since it feels like an easter egg of sorts right now.


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