Skip to content

[azure-ai-ml] Simplify schedule job validation errors - #48424

Merged
lavakumarrepala merged 8 commits into
mainfrom
v-rlava/simplify-schedule-validation-errors
Aug 21, 2026
Merged

[azure-ai-ml] Simplify schedule job validation errors#48424
lavakumarrepala merged 8 commits into
mainfrom
v-rlava/simplify-schedule-validation-errors

Conversation

@lavakumarrepala

@lavakumarrepala lavakumarrepala commented Aug 4, 2026

Copy link
Copy Markdown
Member

Description

  • Select local versus Azure ML job references before schedule validation.
  • Validate only the schema matching the declared scheduled job type.
  • Report the relevant missing-file error without unrelated union-schema failures.
  • Add regression coverage for direct and nested local pipeline references.

Testing

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: fd9e755b-1b9d-4918-aa65-1774f7f78014
@azure-pipelines

Copy link
Copy Markdown
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

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sdk/ml/azure-ai-ml/azure/ai/ml/_schema/schedule/create_job.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have enough unit test coverage for the changes which we are making in this PR?

Copilot AI review requested due to automatic review settings August 19, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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's StringTransformedEnum intentionally accepts and normalizes them. The previous UnionField reached 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
Copilot AI review requested due to automatic review settings August 19, 2026 21:37
@lavakumarrepala

Copy link
Copy Markdown
Member Author

do we have enough unit test coverage for the changes which we are making in this PR?

Jayesh Tanna (@jayesh-tanna) Added unit coverage for the new dispatch paths: direct missing job
references, typed pipeline/command/spark missing references, and unsupported job-type fallback.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PIPELINE are valid because each schema's StringTransformedEnum lowercases its input, but this dispatch compares the raw value case-sensitively. A valid schedule with a missing local file therefore falls through to TypeSensitiveUnionField and reports that PIPELINE is 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)

Copilot AI review requested due to automatic review settings August 20, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. StringTransformedEnum intentionally accepts case-insensitive values, so type: Pipeline is valid; however, with a missing local job this exact-case check falls through to TypeSensitiveUnionField, which then reports that Pipeline is 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)

@lavakumarrepala
lavakumarrepala merged commit f0631be into main Aug 21, 2026
20 checks passed
@lavakumarrepala
lavakumarrepala deleted the v-rlava/simplify-schedule-validation-errors branch August 21, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants