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

   ### Apache Airflow version
   
   2.6.3
   
   ### What happened
   
   I'm observing that when using Microsoft Azure provider with Azure Batch 
service the AzureBatchHook fails to properly detect failed tasks which means 
that airflow task will finish as succeeded instead of failed.
   
   As far as I can tell this comparison: 
https://github.com/apache/airflow/blob/main/airflow/providers/microsoft/azure/hooks/batch.py#L372
 never returns True. I suspect that maybe the enum is generated dynamically or 
using other definition (microsoft's code is pretty weird) and since in Python 
enums are compared using identity instead of value it does not return True even 
for failed tasks.
   
   I tried in my own method the following condition and it worked for me:
   `if task.executionInfo is not None and task.executionInfo.result.value == 
batch_models.TaskExecutionResult.failure.value`
   
   ### What you think should happen instead
   
   When Azure Batch task fails then Python operator should be marked as failed. 
AzureBatchHook.wait_for_job_tasks_to_complete should return list of failed 
tasks.
   
   ### How to reproduce
   
   Well, that would require creating Azure Batch account in Azure then running 
some task using the AzureBatchOperator or PythonOperator with a function that 
utilizes AzureBatchHook
   
   ### Operating System
   
   not sure
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other 3rd-party Helm chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### 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