Skip to content

Commit

Permalink
GHA: test python client connection (#91)
Browse files Browse the repository at this point in the history
Signed-off-by: Isabella Basso do Amaral <[email protected]>
  • Loading branch information
isinyaaa authored May 16, 2024
1 parent 734917a commit ee5ae40
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 184 deletions.
38 changes: 30 additions & 8 deletions .github/workflows/build-image-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Test container image build and deployment
on:
pull_request:
paths-ignore:
- 'LICENSE*'
- '**.gitignore'
- '**.md'
- '**.txt'
- '.github/ISSUE_TEMPLATE/**'
- '.github/dependabot.yml'
- 'docs/**'
- 'clients/python/**'
- "LICENSE*"
- "**.gitignore"
- "**.md"
- "**.txt"
- ".github/ISSUE_TEMPLATE/**"
- ".github/dependabot.yml"
- "docs/**"
- "clients/python/docs/**"
env:
IMG_ORG: kubeflow
IMG_REPO: model-registry
Expand Down Expand Up @@ -61,3 +61,25 @@ jobs:
kubectl wait --for=condition=available -n kubeflow deployment/model-registry-db --timeout=5m
kubectl wait --for=condition=available -n kubeflow deployment/model-registry-deployment --timeout=5m
kubectl logs -n kubeflow deployment/model-registry-deployment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version
- name: Build package
working-directory: clients/python
run: |
poetry build --ansi
pip install dist/*.whl
- name: Connect with Python client
run: |
kubectl port-forward -n kubeflow service/model-registry-service 9090:9090 &
sleep 5
python test/python/test_mr_conn.py localhost 9090
176 changes: 0 additions & 176 deletions test/python/test_mlmetadata.py

This file was deleted.

29 changes: 29 additions & 0 deletions test/python/test_mr_conn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from model_registry import ModelRegistry


def main(server: str, port: int):
mr = ModelRegistry(server, port, author="test", is_secure=False)

model = mr.register_model(
"my-model",
"https://mybucket.uri/",
version="2.0.0",
model_format_name="onnx",
model_format_version="1",
storage_key="my-data-connection",
storage_path="path/to/model",
metadata={
"day": 1,
"split": "train",
},
)

m = mr.get_registered_model("my-model")
assert m
assert model.id == m.id, f"{model} != {m}"


if __name__ == "__main__":
import sys

main(sys.argv[1], int(sys.argv[2]))

0 comments on commit ee5ae40

Please sign in to comment.