trlopes1974 opened a new issue, #40119:
URL: https://github.com/apache/airflow/issues/40119

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.8.2
   
   ### What happened?
   
   Failure callback on SSHOperator is not being called if the 
on_failure_callback is not defined at task level!
   
   With the dag default args:
   Dag Default args:
   default_args = {
       'owner' : 'ttauto',
       'on_success_callback':success_callback,
       'on_failure_callback':failure_callback,
       'depends_on_past': False,
       'start_date': datetime(2021, 1, 1),
       'email': Variable.get("DAG_FAILURE_EMAIL",deserialize_json=True),
       'email_on_failure': True,
       'email_on_retry': False,
       'retries': 0,
       'retry_delay' : timedelta(seconds=20),
       'max_retry_delay' : timedelta(seconds=60),
       'retry_exponential_backoff': True
   }
   
   If you have a task baes on the airflow.providers.ssh.operators.ssh  
SSHOperator, if there is a failures the 'on_failure_callback' defined in the 
DAG default arguments is not called.
   
   Example task:
   ssh_command_operator = SSHOperator(
       task_id='ssh_command_operator',
       command='sudo -s --  eval \'su - XXX -c ". /home/XXX/POEM.env && cd 
KillSession && sqlplus SQLSCRIPT"\'' ,
       ssh_hook=ssh_hook,
       cmd_timeout = 40, 
       conn_timeout= 20,     
       do_xcom_push = True    
       )
   
   
   If the above task fails, the failure callback is not executed.
   
   If you define the task with the callbacks, then the callback is executed:
   ex:
   ssh_command_output_operator = SSHOperator(
       task_id='ssh_command_output_operator',
       command='sudo -s --  eval \'su - XXX -c "SOMECOMMAND"\'' ,
       ssh_hook=ssh_hook,
       cmd_timeout = 90, 
       conn_timeout= 120,
       **on_failure_callback = failure_callback,**    
       do_xcom_push = True    
       )
   
   
   
   
   
   
   
   
   
   
   
   ### What you think should happen instead?
   
   The DAG callback definitions should affect all the dag defined tasks.
   
   ### How to reproduce
   
   In the description
   
   ### Operating System
   
   NAME="Red Hat Enterprise Linux" VERSION="8.8 (Ootpa)" ID="rhel" 
ID_LIKE="fedora" VERSION_ID="8.8" PLATFORM_ID="platform:el8" PRETTY_NAME="Red 
Hat Enterprise Linux 8.8 (Ootpa)" ANSI_COLOR="0;31" 
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos" 
HOME_URL="https://www.redhat.com/"; 
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8";
 BUG_REPORT_URL="https://bugzilla.redhat.com/";  REDHAT_BUGZILLA_PRODUCT="Red 
Hat Enterprise Linux 8" REDHAT_BUGZILLA_PRODUCT_VERSION=8.8 
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" 
REDHAT_SUPPORT_PRODUCT_VERSION="8.8"
   
   ### Versions of Apache Airflow Providers
   
   (env_airflow) [ttauto@slautop03 ~]$ pip freeze | grep 
apache-airflow-providers
   apache-airflow-providers-celery==3.6.0
   apache-airflow-providers-common-io==1.3.0
   apache-airflow-providers-common-sql==1.11.0
   apache-airflow-providers-ftp==3.7.0
   apache-airflow-providers-hashicorp==3.4.2
   apache-airflow-providers-http==4.9.1
   apache-airflow-providers-imap==3.5.0
   apache-airflow-providers-postgres==5.6.0
   apache-airflow-providers-sftp==4.6.1
   apache-airflow-providers-smtp==1.6.1
   apache-airflow-providers-sqlite==3.7.1
   apache-airflow-providers-ssh==3.7.2
   
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   local instalation.
   
   ### Anything else?
   
   We have noticed that both callbacks were not executed. ( success / failure )
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to