Skip to content

Commit a9a76ff

Browse files
authored
Make asset validation work with new schema validation in ADO (#4172)
* Make asset validation work with new ADO validation * Fixing validation script
1 parent 3b1bd21 commit a9a76ff

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

scripts/azureml-assets/azureml/assets/validate_assets.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,13 @@ def validate_model_scenario(
700700
"""
701701
error_count = 0
702702
min_sku = model.properties.get(min_sku_prop_name, "").strip()
703-
recommended_skus = model.properties.get(recommended_skus_prop_name, "").strip()
703+
recommended_skus_value = model.properties.get(recommended_skus_prop_name, None)
704+
if isinstance(recommended_skus_value, str):
705+
recommended_skus = [sku.strip() for sku in recommended_skus_value.split(",") if sku.strip()]
706+
elif isinstance(recommended_skus_value, list):
707+
recommended_skus = [str(sku).strip() for sku in recommended_skus_value if str(sku).strip()]
708+
else:
709+
recommended_skus = []
704710
compute_allowlists = set(model.tags.get(compute_allowlist_tags_name, []))
705711

706712
if not min_sku:
@@ -715,10 +721,10 @@ def validate_model_scenario(
715721
_log_error(asset_file_name_with_path, f"{compute_allowlist_tags_name} is missing in model tags")
716722
error_count += 1
717723

718-
recommended_skus = set([sku.strip() for sku in recommended_skus.split(",")])
719-
if (recommended_skus != compute_allowlists):
720-
a_minus_b = recommended_skus - compute_allowlists
721-
b_minus_a = compute_allowlists - recommended_skus
724+
recommended_skus_set = set(recommended_skus)
725+
if (recommended_skus_set != compute_allowlists):
726+
a_minus_b = recommended_skus_set - compute_allowlists
727+
b_minus_a = compute_allowlists - recommended_skus_set
722728
_log_error(
723729
asset_file_name_with_path,
724730
f"{recommended_skus_prop_name} and {compute_allowlist_tags_name} does not match for model.\n"

0 commit comments

Comments
 (0)