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

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