From 56003dfe59bdd658159c29ac2549c3428c32ab43 Mon Sep 17 00:00:00 2001 From: Pankaj Koti Date: Mon, 21 Oct 2024 17:42:40 +0530 Subject: [PATCH] Use default_arg success callback & define a separate callback function --- examples/example_dag_factory.yml | 6 +++--- examples/print_hello.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/example_dag_factory.yml b/examples/example_dag_factory.yml index f1838628..354b0f61 100644 --- a/examples/example_dag_factory.yml +++ b/examples/example_dag_factory.yml @@ -5,15 +5,15 @@ default: end_date: 2018-03-05 retries: 1 retry_delay_sec: 300 + on_success_callback_name: print_hello_from_callback + on_success_callback_file: $CONFIG_ROOT_DIR/print_hello.py concurrency: 1 max_active_runs: 1 dagrun_timeout_sec: 600 default_view: "tree" orientation: "LR" schedule_interval: "0 1 * * *" - on_success_callback_name: print_hello - on_success_callback_file: $CONFIG_ROOT_DIR/print_hello.py - on_failure_callback_name: print_hello + on_failure_callback_name: print_hello_from_callback on_failure_callback_file: $CONFIG_ROOT_DIR/print_hello.py example_dag: diff --git a/examples/print_hello.py b/examples/print_hello.py index 9673a4dc..c7cedf8f 100644 --- a/examples/print_hello.py +++ b/examples/print_hello.py @@ -1,2 +1,6 @@ def print_hello(): print("hello") + + +def print_hello_from_callback(context): + print("hello from callback")