baha-bouali opened a new pull request, #71981:
URL: https://github.com/apache/airflow/pull/71981

   Follow-up to #71071
   
   I [was 
asked](https://github.com/apache/airflow/pull/71071#discussion_r3803901310) to 
get the `operators/batch.py` entry in `generated/known_airflow_exceptions.txt` 
removed entirely.
   
   ### What changed
   
   `AzureBatchOperator._check_inputs()` had 8 bare `raise 
AirflowException(...)` calls. Each now raises a specific exception instead, 
defined in a new `providers/microsoft/azure/exceptions.py`:
   
   | Condition | Exception |
   |---|---|
   | `vm_publisher` not provided | `AzureBatchVmPublisherMissingError` |
   | `use_latest_verified_vm_image_and_sku` without a complete image spec | 
`AzureBatchLatestImageSpecIncompleteError` |
   | `vm_publisher` without `vm_sku`/`vm_offer`/`vm_node_agent_sku_id` | 
`AzureBatchVmImageSpecIncompleteError` |
   | Neither `target_dedicated_nodes` nor `enable_auto_scale` | 
`AzureBatchPoolSizingMissingError` |
   | `enable_auto_scale` combined with explicit node counts | 
`AzureBatchPoolSizingConflictError` |
   | `enable_auto_scale` without `auto_scale_formula` | 
`AzureBatchAutoScaleFormulaMissingError` |
   | `batch_job_release_task` without `batch_job_preparation_task` | 
`AzureBatchJobPreparationTaskMissingError` |
   | Required pool/job/task parameters missing | 
`AzureBatchRequiredParametersMissingError` |
   
   All 8 subclass `AirflowException`, so existing `except AirflowException` 
handling around this operator is unaffected. Message strings are unchanged — 
only the exception types differ.
   
   The allowlist entry is now gone rather than reduced: the checker deletes the 
line when the count reaches 0.
   
   <img width="1300" height="178" alt="image" 
src="https://github.com/user-attachments/assets/a29f75bd-e206-4917-9fa5-24cf5c5d64da";
 />
   
   
   
   ### Testing
   
   - New `tests/unit/microsoft/azure/test_exceptions.py`: **24** cases covering 
inheritance, raising, and catchability as `AirflowException`.
   - `operators/test_batch.py`: the 19 existing tests passed **unmodified** 
after the change, confirming base-class compatibility. They're now tightened to 
assert the specific exception, and 4 previously untested validation branches 
have coverage: **23** tests total.
   
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes
   - Assited by Claude Sonnet 5. Reviewed, written and tested by the submitter


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