[azure-ai-ml] Simplify schedule job validation errors - #48424
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fd9e755b-1b9d-4918-aa65-1774f7f78014
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Simplifies Azure AI ML schedule validation by selecting the relevant job-reference schema before validation.
Changes:
- Adds targeted local-versus-remote job reference handling.
- Validates schedules against their declared job type.
- Adds missing-file regression tests and changelog documentation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
azure/ai/ml/_schema/schedule/create_job.py |
Adds targeted schedule job validation. |
azure/ai/ml/_schema/schedule/schedule.py |
Uses the new schedule job field. |
tests/schedule/unittests/test_schedule_schema.py |
Tests concise missing-file errors. |
CHANGELOG.md |
Documents the validation fix. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Jayesh Tanna (jayesh-tanna)
left a comment
There was a problem hiding this comment.
do we have enough unit test coverage for the changes which we are making in this PR?
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/schedule/create_job.py:186
- This exact discriminator comparison rejects casing variants such as
type: Pipeline, even though each job schema'sStringTransformedEnumintentionally accepts and normalizes them. The previousUnionFieldreached the matching schema and accepted these values; this path now falls through to a “not in set” error. Normalize string discriminators before selecting the schema.
if isinstance(value, dict) and value.get(self.type_field_name) in self.allowed_types:
field_index = self.allowed_types.index(value[self.type_field_name]) + 1
return self._union_fields[field_index].deserialize(value, attr, data, **kwargs)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2ca0621a-1bde-43dd-96e9-1f82f349a5e7
…tion-errors' into v-rlava/simplify-schedule-validation-errors
Jayesh Tanna (@jayesh-tanna) Added unit coverage for the new dispatch paths: direct missing job |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/schedule/create_job.py:186
- Mixed-case job types such as
PIPELINEare valid because each schema'sStringTransformedEnumlowercases its input, but this dispatch compares the raw value case-sensitively. A valid schedule with a missing local file therefore falls through toTypeSensitiveUnionFieldand reports thatPIPELINEis unsupported instead of the file error this change intends to preserve. Normalize string types before selecting the matching schema.
if isinstance(value, dict) and value.get(self.type_field_name) in self.allowed_types:
field_index = self.allowed_types.index(value[self.type_field_name]) + 1
return self._union_fields[field_index].deserialize(value, attr, data, **kwargs)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/schedule/create_job.py:186
- Normalize the declared type before dispatching.
StringTransformedEnumintentionally accepts case-insensitive values, sotype: Pipelineis valid; however, with a missing local job this exact-case check falls through toTypeSensitiveUnionField, which then reports thatPipelineis unsupported instead of the relevant missing-file error this change is intended to preserve.
if isinstance(value, dict) and value.get(self.type_field_name) in self.allowed_types:
field_index = self.allowed_types.index(value[self.type_field_name]) + 1
return self._union_fields[field_index].deserialize(value, attr, data, **kwargs)
Description
Testing
azpysdk black .azpysdk pylint .python -m pytest tests/schedule/unittests/test_schedule_schema.py tests/schedule/unittests/test_schedule_entity.py -qNo backend service or REST API updates are required. The change is entirely client-side in azure-ai-ml schema validation, affecting how local schedule YAML errors are reported.
No wire format, generated REST model, Swagger, or TypeSpec changes are present. Users receive the fix after the updated SDK package is released.