Skip to content

Commit

Permalink
Added new tasks as examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sarit-si committed Apr 27, 2021
1 parent 5ebdff7 commit 1a4b2c1
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source-code/dags/hello-world.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
description=f"Hello World!!!",
) as dag:

t1 = DummyOperator(
start = DummyOperator(
task_id='Start',
)

t2 = BashOperator(
t1 = BashOperator(
task_id='Trigger_Job',
bash_command='curl "${PDI_CONN_STR}/kettle/executeJob/?rep=test-repo&job=/helloworld/helloworld-job"'
)

t3 = BashOperator(
t2 = BashOperator(
task_id='Trigger_Transformation',
bash_command='curl "${PDI_CONN_STR}/kettle/executeTrans/?rep=test-repo&trans=/helloworld/helloworld-trans"'
)

t4 = DummyOperator(
stop = DummyOperator(
task_id='Stop',
)

t1 >> [t2, t3] >> t4
start >> [t1, t2] >> stop
54 changes: 54 additions & 0 deletions source-code/dags/parallel-tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# To illustrate how we can trigger a job/transformation in the PDI container via Carte APIs
# Reference: https://help.pentaho.com/Documentation/9.1/Developer_center/REST_API_Reference/Carte

from airflow import DAG
from airflow.utils.dates import days_ago
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy import DummyOperator

args = {
"owner": "airflow",
"start_date": days_ago(1),
"depends_on_past": False,
"wait_for_downstream": False,
"catchup": False,
}


with DAG(
dag_id="hello-world",
default_args=args,
schedule_interval=None,
catchup=False,
description=f"Hello World!!!",
) as dag:

start = DummyOperator(
task_id='Start',
)

t1 = BashOperator(
task_id='Trigger_Job1',
bash_command='curl "${PDI_CONN_STR}/kettle/executeJob/?rep=test-repo&job=/helloworld/helloworld-job"'
)

t2 = BashOperator(
task_id='Trigger_Job2',
bash_command='curl "${PDI_CONN_STR}/kettle/executeJob/?rep=test-repo&job=/helloworld/helloworld-job"'
)

t3 = BashOperator(
task_id='Trigger_Job3',
bash_command='curl "${PDI_CONN_STR}/kettle/executeJob/?rep=test-repo&job=/helloworld/helloworld-job"'
)

t4 = BashOperator(
task_id='Trigger_Transformation',
bash_command='curl "${PDI_CONN_STR}/kettle/executeTrans/?rep=test-repo&trans=/helloworld/helloworld-trans"'
)

stop = DummyOperator(
task_id='Stop',
)

start >> [t1, t2, t3, t4] >> stop

0 comments on commit 1a4b2c1

Please sign in to comment.