Skip to content

Commit

Permalink
Add additional model version deletion steps at the end of each integr…
Browse files Browse the repository at this point in the history
…ation test
  • Loading branch information
deadlycoconuts committed Feb 9, 2024
1 parent c4b0ff4 commit 0396604
Showing 1 changed file with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions python/sdk/test/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def test_model_version_with_labels(
)
assert len(should_not_exist_versions) == 0

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
@pytest.mark.dependency()
Expand Down Expand Up @@ -109,6 +116,13 @@ def test_sklearn(

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
@pytest.mark.dependency()
Expand Down Expand Up @@ -141,6 +155,14 @@ def test_xgboost(

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
@pytest.mark.dependency()
@pytest.mark.parametrize(
Expand Down Expand Up @@ -190,6 +212,12 @@ def test_model_schema(

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
Expand Down Expand Up @@ -239,6 +267,13 @@ def test_mlflow_tracking(
# artifact_dir = os.listdir('test/downloaded_artifact')
# assert len(artifact_dir) > 0 # not empty directory

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
@pytest.mark.dependency()
Expand Down Expand Up @@ -271,6 +306,13 @@ def test_tensorflow(

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.pytorch
@pytest.mark.integration
Expand All @@ -296,6 +338,13 @@ def test_pytorch(integration_test_url, project_name, use_google_oauth, requests)

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.serving
@pytest.mark.integration
Expand Down Expand Up @@ -337,6 +386,13 @@ def test_set_traffic(integration_test_url, project_name, use_google_oauth, reque
# Undeploy other running model version endpoints
undeploy_all_version()

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.serving
@pytest.mark.integration
Expand Down Expand Up @@ -378,6 +434,13 @@ def test_serve_traffic(integration_test_url, project_name, use_google_oauth, req
# Undeploy other running model version endpoints
undeploy_all_version()

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
def test_multi_env(integration_test_url, project_name, use_google_oauth, requests):
Expand Down Expand Up @@ -408,6 +471,13 @@ def test_multi_env(integration_test_url, project_name, use_google_oauth, request

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
@pytest.mark.parametrize(
Expand Down Expand Up @@ -451,6 +521,13 @@ def test_resource_request(

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.gpu
@pytest.mark.integration
Expand Down Expand Up @@ -549,6 +626,13 @@ def test_logger(

merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.customtransformer
@pytest.mark.integration
Expand Down Expand Up @@ -723,6 +807,13 @@ def test_standard_transformer_without_feast(
) # asserts lhs = rhs, with tolerance
merlin.undeploy(v)

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.feast
@pytest.mark.integration
Expand Down Expand Up @@ -976,6 +1067,13 @@ def test_custom_model_without_artifact(
# Undeploy other running model version endpoints
undeploy_all_version()

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
@pytest.mark.parametrize(
Expand Down Expand Up @@ -1013,6 +1111,13 @@ def test_custom_model_with_artifact(
# Undeploy other running model version endpoints
undeploy_all_version()

print(f"Deleting model version created...")
try:
v.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.raw_deployment
@pytest.mark.integration
Expand Down Expand Up @@ -1099,6 +1204,13 @@ def test_deployment_mode_for_serving_model(
merlin.stop_serving_traffic(model_endpoint.environment_name)
undeploy_all_version()

print(f"Deleting model version created...")
try:
v2.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


@pytest.mark.integration
def test_redeploy_model(integration_test_url, project_name, use_google_oauth, requests):
Expand Down Expand Up @@ -1183,6 +1295,13 @@ def test_redeploy_model(integration_test_url, project_name, use_google_oauth, re

undeploy_all_version()

print(f"Deleting model version created...")
try:
v1.delete_model_version()
except Exception as e:
print(e)
print(f"Model version deleted.")


def deployment_mode_suffix(deployment_mode: DeploymentMode):
return deployment_mode.value.lower()[0:1]
Expand Down

0 comments on commit 0396604

Please sign in to comment.