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

fix: Widen system test timeout, handle tearing down failed training pipelines #791

Merged
merged 2 commits into from Oct 26, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .kokoro/continuous/system.cfg
Expand Up @@ -10,3 +10,6 @@ env_vars: {
key: "PYTEST_ADDOPTS"
value: "-n=auto --dist=loadscope"
}

# Kokoro VM timeout of 5 hours for system tests
timeout_mins: 300
35 changes: 21 additions & 14 deletions samples/snippets/conftest.py
Expand Up @@ -15,6 +15,8 @@
import os
from uuid import uuid4

from google.api_core import exceptions

from google.cloud import aiplatform, aiplatform_v1beta1
from google.cloud import bigquery
from google.cloud import storage
Expand Down Expand Up @@ -175,22 +177,27 @@ def teardown_hyperparameter_tuning_job(shared_state, job_client):
def teardown_training_pipeline(shared_state, pipeline_client):
yield

pipeline_client.cancel_training_pipeline(
name=shared_state["training_pipeline_name"]
)
try:
pipeline_client.cancel_training_pipeline(
name=shared_state["training_pipeline_name"]
)

# Waiting for training pipeline to be in CANCELLED state
timeout = shared_state["cancel_batch_prediction_job_timeout"]
helpers.wait_for_job_state(
get_job_method=pipeline_client.get_training_pipeline,
name=shared_state["training_pipeline_name"],
timeout=timeout,
)
# Waiting for training pipeline to be in CANCELLED state
timeout = shared_state["cancel_batch_prediction_job_timeout"]
helpers.wait_for_job_state(
get_job_method=pipeline_client.get_training_pipeline,
name=shared_state["training_pipeline_name"],
timeout=timeout,
)

# Delete the training pipeline
pipeline_client.delete_training_pipeline(
name=shared_state["training_pipeline_name"]
)
except exceptions.FailedPrecondition:
pass # If pipeline failed, ignore and skip directly to deletion

finally:
# Delete the training pipeline
pipeline_client.delete_training_pipeline(
name=shared_state["training_pipeline_name"]
)


@pytest.fixture()
Expand Down