Skip to content

Commit

Permalink
[Datastore] Improve error on invalid URL in get_store_resource() (#…
Browse files Browse the repository at this point in the history
…5619)

Relates to [ML-6520](https://iguazio.atlassian.net/browse/ML-6520).

The new check is added to avoid this error on an invalid URL:
```
mlrun.errors.MLRunInvalidArgumentError: Field 'model_endpoint.spec.model_uri' should be of type 'ModelArtifact' (got: DataItem with value: ).
```
  • Loading branch information
gtopper committed May 26, 2024
1 parent a537c92 commit 94261fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mlrun/datastore/store_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ def get_store_resource(

db = db or mlrun.get_run_db(secrets=secrets)
kind, uri = parse_store_uri(uri)
if kind == StorePrefix.FeatureSet:
if not kind:
raise mlrun.errors.MLRunInvalidArgumentError(
f"Cannot get store resource from invalid URI: {uri}"
)
elif kind == StorePrefix.FeatureSet:
project, name, tag, uid = parse_versioned_object_uri(
uri, project or config.default_project
)
Expand Down

0 comments on commit 94261fa

Please sign in to comment.