VBhojawala opened a new pull request #13912:
URL: https://github.com/apache/airflow/pull/13912


   Added @python_task decorator for PythonOperator which can be used as shown 
in following example 
   
   ```  python
   from airflow.models import DAG
   import os
   
   from airflow.operators.python import python_task, PythonOperator
   from airflow.utils.dates import days_ago
   
   default_args = {'start_date': days_ago(1)}
   dag_name = os.path.splitext(os.path.basename(__file__))[0]
   
   
   @python_task
   def some_py_task(name):
       """ some py task """
       print(f'Inside Python Task name: {name}')
   
   
   def some_other_task(name):
       """ some other task"""
       print(f'Inside {name} Task')
   
   
   with DAG(dag_name, default_args=default_args) as dag:
   
       t1 = some_py_task(task_id='task1')('Python Task 1')
       t2 = some_py_task(task_id='task2')('Python Task 2')
   
       t3 = PythonOperator(python_callable=some_other_task, task_id='task3', 
op_args=['task3'])
   
       t1 >> t2 >> t3
   
   ```
   
   ![Screenshot from 2021-01-26 
14-54-47](https://user-images.githubusercontent.com/11897651/105826324-a200a480-5fe6-11eb-92cc-d7337fe367ad.png)


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