I'm trying to call a python operator which is inside a function using another python operator. Seems something I missed, can someone help me to find out what I missed.
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.bash_operator import BashOperator
from datetime import datetime
args = {
'owner': 'airflow',
'start_date': '2018, 11, 1',
'retries': 0
}
def testfunc(taskid,dagname):
BashOperator(
task_id=taskid,
bash_command='echo "wwwwwwwwwwwwwww"',
default_args=args,
dag=dagname)
with DAG('python_dag', description='Python DAG', schedule_interval='*/15 * * * *', start_date=datetime(2018, 11, 1), catchup=False) as dag:
python_task = PythonOperator(task_id='python_task', python_callable=testfunc,op_args=['ttest-task',dag])
python_task