I' am new in BI and I need some help I'am using windows Jobscheduler in order to executer tasks , but sometimes it bugs so i am moving to apache airflow , I have already a bat file who execute but I want to use it in apache airflow dags , this is my file bat code
cd /d D:\EXMOOV\Scripts
call RunDTS.bat EXMOOV Js_002_MOOV_AIR
I want to put it in a dag file code in order to execute it , so I took an example of a Dag code and try it to put it so the file become unreadable and apache airflow didin't read it , this is my try :
from datetime import timedelta
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.utils.dates import days_ago
default_args = {
'owner': 'Brahim',
'depends_on_past': False,
'start_date': days_ago(2),
'email': ['airflow@example.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=2),
}
dag = DAG(
'My_first_test_code',
default_args=default_args,
description='A simple tutorial DAG',
schedule_interval=timedelta(days=1),
)
t1 = BashOperator(
task_id='print_date',
bash_command='date',
dag=dag,
)
cd /d D:\EXMOOV\Scripts
call RunDTS.bat EXMOOV Js_002_MOOV_AIR
t2 = BashOperator(
task_id='sleep',
depends_on_past=False,
bash_command='sleep 5',
retries=3,
dag=dag,
)
dag.doc_md = __doc__
t1.doc_md = """\
templated_command = """
{% for i in range(5) %}
echo "{{ ds }}"
echo "{{ macros.ds_add(ds, 7)}}"
echo "{{ params.my_param }}"
{% endfor %}
"""
t3 = BashOperator(
task_id='templated',
depends_on_past=False,
bash_command=templated_command,
params={'my_param': 'Parameter I passed in'},
dag=dag,
)
t1 >> [t2, t3]
I just want those a dag file who read those two lines that's all in order to execute the script the file in format .bat used to execute etl jobs in ibm datastage .