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
5 changes: 4 additions & 1 deletion sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ def _deserialize(self, value, attr, data, **kwargs):
if not path.is_absolute():
path = base_path / path
path.resolve()
data = load_file(path)
try:
data = load_file(path)
except (FileNotFoundError, OSError) as e:
raise ValidationError(f"No such file or directory: {path}") from e
return data
raise ValidationError(f"Not supporting non file for {attr}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,13 @@ 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_schedule_with_missing_create_job_file(self):
test_path = "./tests/test_configs/schedule/invalid/hello_cron_schedule_with_missing_job_file.yml"
with pytest.raises(ValidationError) as e:
load_schedule(test_path)
error_message = str(e.value)
assert "No such file or directory:" in error_message
assert "missing_pipeline.yml" in error_message
assert "In order to specify an existing jobs" not in error_message
assert "Not supporting non file for create_job" not in error_message
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$schema: http://azureml/sdk-2-0/Schedule.json
name: weekly_retrain_2022_missing_file
display_name: weekly retrain schedule
description: a weekly retrain schedule

trigger:
type: cron
expression: "15 10 * * 1"
start_time: "2022-03-10T10:15:00"

create_job: ./missing_pipeline.yml
Loading