Compare commits

..
Author SHA1 Message Date
Alexey VolkovandGitHub 67d8d949e3 Fixed the version of the Scikit-learn component 2022-12-14 16:54:17 -08:00
9 changed files with 19 additions and 135 deletions
+5 -1
View File
@@ -5,6 +5,8 @@ from resource_cleanup_manager import (
ModelResourceCleanupManager,
EndpointResourceCleanupManager,
ResourceCleanupManager,
MatchingEngineIndexEndpointResourceCleanupManager,
MatchingEngineIndexResourceCleanupManager,
)
rate_limit = RateLimit(max_count=25, per=60, greedy=False)
@@ -40,10 +42,12 @@ if is_dry_run:
print("Starting cleanup in dry run mode...")
# List of all cleanup managers
managers = [
managers: List[ResourceCleanupManager] = [
DatasetResourceCleanupManager(),
EndpointResourceCleanupManager(),
ModelResourceCleanupManager(), # ModelResourceCleanupManager must follow EndpointResourceCleanupManager due to deployed models blocking model deletion.
MatchingEngineIndexEndpointResourceCleanupManager(),
MatchingEngineIndexResourceCleanupManager(),
]
run_cleanup_managers(managers=managers, is_dry_run=is_dry_run)
@@ -110,3 +110,10 @@ class EndpointResourceCleanupManager(VertexAIResourceCleanupManager):
class ModelResourceCleanupManager(VertexAIResourceCleanupManager):
vertex_ai_resource = aiplatform.Model
class MatchingEngineIndexResourceCleanupManager(VertexAIResourceCleanupManager):
vertex_ai_resource = aiplatform.MatchingEngineIndex
class MatchingEngineIndexEndpointResourceCleanupManager(VertexAIResourceCleanupManager):
vertex_ai_resource = aiplatform.MatchingEngineIndexEndpoint
@@ -245,15 +245,13 @@ def process_and_execute_notebook(
result.logs_bucket = operation_metadata.build.logs_bucket
# Block and wait for the result
operation_result = operation.result(timeout=84600)
operation_result = operation.result()
result.duration = datetime.datetime.now() - time_start
result.is_pass = True
print(f"{notebook} PASSED in {format_timedelta(result.duration)}.")
except Exception as error:
result.error_message = str(error)
import traceback
traceback.print_exc()
if operation and should_get_tail_logs:
# Extract the logs
-1
View File
@@ -66,7 +66,6 @@ def execute_notebook(
# Execute notebook
try:
print("DEBUG HERE\n")
# Execute notebook
pm.execute_notebook(
input_path=notebook_source,
+1 -11
View File
@@ -45,9 +45,6 @@ def execute_notebook_remote(
"""Create and execute a single notebook on Google Cloud Build"""
# Load build steps from YAML
print(f"DEBUG TIMEOUT {timeout_in_seconds}\n")
cloudbuild_config = yaml.load(open(CLOUD_BUILD_FILEPATH), Loader=FullLoader)
substitutions = {
@@ -98,14 +95,7 @@ def execute_notebook_remote(
if tag:
build.tags = [tag]
try:
print("DEBUG: START\n")
operation = client.create_build(project_id=project_id, build=build)
except Exception as e:
import traceback
traceback.print_exc()
print("DEBUG: FINISH\n")
print(operation)
operation = client.create_build(project_id=project_id, build=build)
# Print the in-progress operation
# print("IN PROGRESS:")
# print(operation.metadata)
@@ -36,7 +36,7 @@ steps:
- -c
- |
. workspace/env/bin/activate &&
python3 .cloud-build/execute_changed_notebooks_cli.py --test_paths_file "${_TEST_PATHS_FILE}" --base_branch "${_FORCED_BASE_BRANCH}" --container_uri ${_PYTHON_IMAGE} --staging_bucket ${_GCS_STAGING_BUCKET} --artifacts_bucket ${_GCS_STAGING_BUCKET}/executed_notebooks/PR_${_PR_NUMBER}/BUILD_${BUILD_ID} --variable_project_id ${PROJECT_ID} --variable_region ${_GCP_REGION} --variable_service_account ${_GCP_SERVICE_ACCOUNT} --variable_vpc_network "${_GPC_VPC_NETWORK_NAME}" --timeout 86400 `if [ ! -z "${_PRIVATE_POOL_NAME}" ]; then echo "--private_pool_id ${_PRIVATE_POOL_NAME}"; fi`
python3 .cloud-build/execute_changed_notebooks_cli.py --test_paths_file "${_TEST_PATHS_FILE}" --base_branch "${_FORCED_BASE_BRANCH}" --container_uri ${_PYTHON_IMAGE} --staging_bucket ${_GCS_STAGING_BUCKET} --artifacts_bucket ${_GCS_STAGING_BUCKET}/executed_notebooks/PR_${_PR_NUMBER}/BUILD_${BUILD_ID} --variable_project_id ${PROJECT_ID} --variable_region ${_GCP_REGION} --variable_service_account ${_GCP_SERVICE_ACCOUNT} --variable_vpc_network "${_GPC_VPC_NETWORK_NAME}" `if [ ! -z "${_PRIVATE_POOL_NAME}" ]; then echo "--private_pool_id ${_PRIVATE_POOL_NAME}"; fi`
env:
- 'IS_TESTING=1'
timeout: 86400s
+2 -3
View File
@@ -8,7 +8,6 @@ matplotlib
tabulate
google-cloud-aiplatform
google-cloud-storage
google-cloud-build==3.9.3
protobuf==4.21.9
google-cloud-build
ratemate
GitPython
GitPython
@@ -6,8 +6,8 @@ download_from_gcs_op = components.load_component_from_url("https://raw.githubuse
select_columns_using_Pandas_on_CSV_data_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/pandas/Select_columns/in_CSV_format/component.yaml")
fill_all_missing_values_using_Pandas_on_CSV_data_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/pandas/Fill_all_missing_values/in_CSV_format/component.yaml")
binarize_column_using_Pandas_on_CSV_data_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/pandas/Binarize_column/in_CSV_format/component.yaml")
train_logistic_regression_model_using_scikit_learn_from_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/ML_frameworks/Scikit_learn/Train_logistic_regression_model/from_CSV/component.yaml")
upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/1f5cf6e06409b704064b2086c0a705e4e6b4fcde/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_Scikit-learn_pickle_model/component.yaml")
train_logistic_regression_model_using_scikit_learn_from_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/1f5cf6e06409b704064b2086c0a705e4e6b4fcde/community-content/pipeline_components/ML_frameworks/Scikit_learn/Train_logistic_regression_model/from_CSV/component.yaml")
upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_Scikit-learn_pickle_model/component.yaml")
deploy_model_to_endpoint_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Deploy_to_endpoint/component.yaml")
# %% Pipeline definition
-113
View File
@@ -1,113 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "82b522b9e130"
},
"outputs": [],
"source": [
"import time"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "7dc682542238"
},
"outputs": [],
"source": [
"# 5 mins\n",
"time.sleep(5 * 60)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3ab331234b42"
},
"outputs": [],
"source": [
"print(\"5 minutes\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "2a5ea0ae33f0"
},
"outputs": [],
"source": [
"time.sleep(10 * 60)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ab9a3894d60e"
},
"outputs": [],
"source": [
"print(\"15 minutes\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "d9efa8e9b70a"
},
"outputs": [],
"source": [
"time.sleep(5 * 60)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "bc63b3db2e71"
},
"outputs": [],
"source": [
"print(\"20 minutes\")"
]
}
],
"metadata": {
"colab": {
"name": "test.ipynb",
"toc_visible": true
},
"environment": {
"kernel": "python3",
"name": "common-cpu.m95",
"type": "gcloud",
"uri": "gcr.io/deeplearning-platform-release/base-cpu:m95"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 4
}