sassoftware / sas-airflow-provider

Apache Airflow Provider for creating tasks in Airflow to execute SAS Studio Flows and Jobs.
Apache License 2.0
18 stars 15 forks source link

Update sas_studio.py - add on_failure_callback function #32

Closed Dario-koltu closed 7 months ago

Dario-koltu commented 7 months ago

Adding the possibility to use own functions in parameter "on_failure_callback". We need to have a chance to alert clients (by creating Jira tickets) once the task fails. Till now the parameter "on_failure_callback" was occupied by clean_up function and airflow allowed only one function to be passed. Now that airflow updated this and allows an array of functions to be passed. We are using this to pass our function to create Jira Tickets.

Dario-koltu commented 7 months ago

This has been tested on our environment with different scenarios: (In case links to runs are needed, please contact me via sas internal).

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

IS PARAMETER PASSED? |   |   |   |   |   |   -- | -- | -- | -- | -- | -- | -- on_failure_callback | clean_up | Expected Error | File present? | Actual Error | Function used in Dag | Test Result | Ticket created yes | no triggered | No connection to viya | x | No connection to viya | SasStudioOperator | v | yes yes | yes | File not present | No | File not present | SasStudioOperator | v | yes no | yes | File not present | No | File not present | SasStudioOperator | v | no no | yes | Some code error | Yes | Error encountered during code generation | SasStudioOperator | v | no yes | yes | Some code error | Yes | Error encountered during code generation | SasStudioOperator | v | yes yes | yes | Some code error | Yes | Error encountered during code generation | RunSasStudioFlow | v | yes no | yes | Some code error | Yes | Error encountered during code generation | RunSasStudioFlow | v | no