Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: show s3_uri_from format in pure REST test #219

Merged
Merged
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
6 changes: 6 additions & 0 deletions test/robot/MRkeywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,9 @@ I get ArtifactsByModelVersionID
Fail Not Implemented
END
RETURN ${result}


I use util s3_uri_from
[Arguments] ${path} ${bucket} ${endpoint} ${region}
${result}= s3_uri_from path=${path} bucket=${bucket} endpoint=${endpoint} region=${region}
RETURN ${result}
7 changes: 7 additions & 0 deletions test/robot/ModelRegistry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from model_registry.core import ModelRegistryAPIClient
from model_registry.types import ModelArtifact, ModelVersion, RegisteredModel
from robot.libraries.BuiltIn import BuiltIn
import model_registry.utils


def write_to_console(s):
Expand Down Expand Up @@ -33,6 +34,12 @@ async def upsert_model_artifact(
write_to_console(p)
return (await self.api.upsert_model_artifact(p, model_version_id)).id

def s3_uri_from(self, path, bucket, endpoint, region) -> str:
"""
Expose util to RobotFramework
"""
return model_registry.utils.s3_uri_from(path=path, bucket=bucket, endpoint=endpoint, region=region)


async def test():
demo_instance = ModelRegistry()
Expand Down
29 changes: 29 additions & 0 deletions test/robot/UserStory.robot
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,32 @@ As a MLOps engineer I would like to store an owner for the RegisteredModel
${r} Then I get RegisteredModelByID id=${rId}
And Should be equal ${r["description"]} Lorem ipsum dolor sit amet
And Should be equal ${r["owner"]} My owner

As a MLOps engineer I want to track a Model from an S3 bucket Data Connection
${data_connection_name} Set Variable aws-connection-my-data-connection
${s3_bucket} Set Variable my-bucket
${s3_path} Set Variable my-path
${s3_endpoint} Set Variable https://minio-api.acme.org
${s3_region} Set Variable us-east-1

Set To Dictionary ${registered_model} description=The Model name=${name}
Set To Dictionary ${model_version} description=The Version name=v1.0
${art_uri} I use util s3_uri_from path=${s3_path} bucket=${s3_bucket} endpoint=${s3_endpoint} region=${s3_region}
Set To Dictionary ${model_artifact} description=The Artifact uri=${art_uri} modelFormatName=onnx modelFormatVersion=1 storageKey=${data_connection_name} storagePath=${s3_path}
Log to console ${model_artifact}

${rId} Given I create a RegisteredModel payload=${registered_model}
${vId} And I create a child ModelVersion registeredModelID=${rId} payload=&{model_version}
${aId} And I create a child ModelArtifact modelversionId=${vId} payload=&{model_artifact}
${r} Then I get RegisteredModelByID id=${rId}
And Should be equal ${r["description"]} The Model
${r} Then I get ModelVersionByID id=${vId}
And Should be equal ${r["description"]} The Version
And Should be equal ${r["name"]} v1.0
${r} Then I get ModelArtifactByID id=${aId}
And Should be equal ${r["description"]} The Artifact
And Should be equal ${r["uri"]} s3://my-bucket/my-path?endpoint=https://minio-api.acme.org&defaultRegion=us-east-1
And Should be equal ${r["modelFormatName"]} onnx
And Should be equal ${r["modelFormatVersion"]} 1
And Should be equal ${r["storageKey"]} aws-connection-my-data-connection
And Should be equal ${r["storagePath"]} my-path
Loading