Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions sdk/ml/azure-ai-ml/azure/ai/ml/_schema/schedule/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from marshmallow import fields

from azure.ai.ml._schema.core.fields import ArmStr, NestedField, UnionField
from azure.ai.ml._schema.core.fields import ArmStr, NestedField, TypeSensitiveUnionField, UnionField
from azure.ai.ml._schema.core.resource import ResourceSchema
from azure.ai.ml._schema.job import CreationContextSchema
from azure.ai.ml._schema.schedule.create_job import (
Expand Down Expand Up @@ -33,12 +33,14 @@ class ScheduleSchema(ResourceSchema):


class JobScheduleSchema(ScheduleSchema):
create_job = UnionField(
[
create_job = TypeSensitiveUnionField(
{
"pipeline": [NestedField(PipelineCreateJobSchema)],
"command": [NestedField(CommandCreateJobSchema)],
"spark": [NestedField(SparkCreateJobSchema)],
},
plain_union_fields=[
ArmStr(azureml_type=AzureMLResourceType.JOB),
CreateJobFileRefField,
NestedField(PipelineCreateJobSchema),
NestedField(CommandCreateJobSchema),
NestedField(SparkCreateJobSchema),
]
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,14 @@ def test_load_invalid_schedule_missing_type(self):
with pytest.raises(ValidationError) as e:
load_schedule(test_path)
assert "'type' must be specified when scheduling a remote job with updates." in e.value.messages[0]

def test_load_invalid_schedule_pipeline_file_not_found_error_simplified(self):
test_path = "./tests/test_configs/schedule/invalid/hello_cron_schedule_with_pipeline_file_not_found.yml"
with pytest.raises(ValidationError) as e:
load_schedule(test_path)

error_message = str(e.value.messages)
assert "No such file or directory" in error_message
assert "Not supporting non file for create_job" not in error_message
assert "Value 'pipeline' passed is not in set ['command']" not in error_message
assert "Value 'pipeline' passed is not in set ['spark']" not in error_message
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$schema: https://azuremlschemas.azureedge.net/latest/schedule.schema.json
name: weekly_retrain_2022_cron_pipeline_file_not_found
trigger:
type: cron
expression: "15 10 * * 1"
create_job:
type: pipeline
job: ../pipeline.yml
Loading