Replace generic AirflowException in AzureBatchOperator input validation - #71981
Open
baha-bouali wants to merge 1 commit into
Open
Replace generic AirflowException in AzureBatchOperator input validation#71981baha-bouali wants to merge 1 commit into
baha-bouali wants to merge 1 commit into
Conversation
Signed-off-by: baha-bouali <baha.bouali2020@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #71071
CONTEXT: get the
operators/batch.pyentry ingenerated/known_airflow_exceptions.txtremoved entirely.What changed
AzureBatchOperator._check_inputs()had 8 bareraise AirflowException(...)calls. Each now raises a specific exception instead, defined in a newproviders/microsoft/azure/exceptions.py:vm_publishernot providedAzureBatchVmPublisherMissingErroruse_latest_verified_vm_image_and_skuwithout a complete image specAzureBatchLatestImageSpecIncompleteErrorvm_publisherwithoutvm_sku/vm_offer/vm_node_agent_sku_idAzureBatchVmImageSpecIncompleteErrortarget_dedicated_nodesnorenable_auto_scaleAzureBatchPoolSizingMissingErrorenable_auto_scalecombined with explicit node countsAzureBatchPoolSizingConflictErrorenable_auto_scalewithoutauto_scale_formulaAzureBatchAutoScaleFormulaMissingErrorbatch_job_release_taskwithoutbatch_job_preparation_taskAzureBatchJobPreparationTaskMissingErrorAzureBatchRequiredParametersMissingErrorAll 8 subclass
AirflowException, so existingexcept AirflowExceptionhandling 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.
Testing
tests/unit/microsoft/azure/test_exceptions.py: 24 cases covering inheritance, raising, and catchability asAirflowException.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?