-
Notifications
You must be signed in to change notification settings - Fork 348
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
feat: Make matching engine API public #1192
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c8a6fd5
Reinstated matching engine
ivanmkc 17bb41d
Reinstated VPC-dependent system tests
ivanmkc 242e188
Debug
ivanmkc 304ece9
Commented out test
ivanmkc 4ce4df8
Fix resource bug when the key doesn't exist
ivanmkc e45bc19
Skip tests for now
ivanmkc c0c0825
Tweaked logs
ivanmkc 284acf2
Raise
ivanmkc a5b8041
Added VPC preparation and deletion
ivanmkc a5c1251
Fixed firewall deletion code
ivanmkc 9b085c6
Reinstate system tests
ivanmkc 49d5575
Removed VPC network generation code
ivanmkc 4cfb0c9
Updated system tests
ivanmkc f9131ea
Fixed matching engine system tests
ivanmkc 7e907db
Reverted skips
ivanmkc 1b7fd78
Ran linter
ivanmkc a605913
Moved protos to their own folder
ivanmkc ffbb231
Removed constant for VPC network
ivanmkc 8ebcb8e
Added protos
ivanmkc 5b12374
Fixed import
ivanmkc 7908c68
Fixed network constsant
ivanmkc 91ae18f
Fixed reversion issue
ivanmkc 46d77bd
Removed unused imports
ivanmkc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
# | ||
|
||
import uuid | ||
import pytest | ||
|
||
from google.cloud import aiplatform | ||
|
||
|
@@ -52,10 +51,6 @@ | |
_TEST_INDEX_ENDPOINT_DISPLAY_NAME = "endpoint_name" | ||
_TEST_INDEX_ENDPOINT_DESCRIPTION = "my endpoint" | ||
|
||
_TEST_INDEX_ENDPOINT_VPC_NETWORK = "projects/{}/global/networks/{}".format( | ||
e2e_base._PROJECT_NUMBER, e2e_base._VPC_NETWORK_NAME | ||
) | ||
|
||
# DEPLOYED INDEX | ||
_TEST_DEPLOYED_INDEX_ID = f"deployed_index_id_{uuid.uuid4()}" | ||
_TEST_DEPLOYED_INDEX_DISPLAY_NAME = f"deployed_index_display_name_{uuid.uuid4()}" | ||
|
@@ -167,7 +162,6 @@ | |
] | ||
|
||
|
||
@pytest.mark.skip(reason="TestMatchingEngine not available") | ||
class TestMatchingEngine(e2e_base.TestEndToEnd): | ||
|
||
_temp_prefix = "temp_vertex_sdk_e2e_matching_engine_test" | ||
|
@@ -226,9 +220,84 @@ def test_create_get_list_matching_engine_index(self, shared_state): | |
|
||
assert updated_index.name == get_index.name | ||
|
||
# Create endpoint and check that it is listed | ||
my_index_endpoint = aiplatform.MatchingEngineIndexEndpoint.create( | ||
display_name=_TEST_INDEX_ENDPOINT_DISPLAY_NAME, | ||
description=_TEST_INDEX_ENDPOINT_DESCRIPTION, | ||
network=e2e_base._VPC_NETWORK_URI, | ||
labels=_TEST_LABELS, | ||
) | ||
assert my_index_endpoint.resource_name in [ | ||
index_endpoint.resource_name | ||
for index_endpoint in aiplatform.MatchingEngineIndexEndpoint.list() | ||
] | ||
|
||
assert my_index_endpoint.labels == _TEST_LABELS | ||
assert my_index_endpoint.display_name == _TEST_INDEX_ENDPOINT_DISPLAY_NAME | ||
assert my_index_endpoint.description == _TEST_INDEX_ENDPOINT_DESCRIPTION | ||
|
||
shared_state["resources"].append(my_index_endpoint) | ||
|
||
# Deploy endpoint | ||
my_index_endpoint = my_index_endpoint.deploy_index( | ||
index=index, | ||
deployed_index_id=_TEST_DEPLOYED_INDEX_ID, | ||
display_name=_TEST_DEPLOYED_INDEX_DISPLAY_NAME, | ||
) | ||
|
||
# Update endpoint | ||
updated_index_endpoint = my_index_endpoint.update( | ||
display_name=_TEST_DISPLAY_NAME_UPDATE, | ||
description=_TEST_DESCRIPTION_UPDATE, | ||
labels=_TEST_LABELS_UPDATE, | ||
) | ||
|
||
assert updated_index_endpoint.labels == _TEST_LABELS_UPDATE | ||
assert updated_index_endpoint.display_name == _TEST_DISPLAY_NAME_UPDATE | ||
assert updated_index_endpoint.description == _TEST_DESCRIPTION_UPDATE | ||
|
||
# Mutate deployed index | ||
my_index_endpoint.mutate_deployed_index( | ||
deployed_index_id=_TEST_DEPLOYED_INDEX_ID, | ||
min_replica_count=_TEST_MIN_REPLICA_COUNT_UPDATED, | ||
max_replica_count=_TEST_MAX_REPLICA_COUNT_UPDATED, | ||
) | ||
|
||
deployed_index = my_index_endpoint.deployed_indexes[0] | ||
|
||
assert deployed_index.id == _TEST_DEPLOYED_INDEX_ID | ||
assert deployed_index.index == index.resource_name | ||
assert ( | ||
deployed_index.automatic_resources.min_replica_count | ||
== _TEST_MIN_REPLICA_COUNT_UPDATED | ||
) | ||
assert ( | ||
deployed_index.automatic_resources.max_replica_count | ||
== _TEST_MAX_REPLICA_COUNT_UPDATED | ||
) | ||
|
||
# TODO: Test `my_index_endpoint.match` request. This requires running this test in a VPC. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still don't know how to run the whole system test "inside" the VPC network. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am asking around. |
||
# results = my_index_endpoint.match( | ||
# deployed_index_id=_TEST_DEPLOYED_INDEX_ID, queries=[_TEST_MATCH_QUERY] | ||
# ) | ||
|
||
# assert results[0][0].id == 870 | ||
|
||
# Undeploy index | ||
my_index_endpoint = my_index_endpoint.undeploy_index( | ||
deployed_index_id=deployed_index.id | ||
) | ||
|
||
# Delete index and check that it is no longer listed | ||
index.delete() | ||
list_indexes = aiplatform.MatchingEngineIndex.list() | ||
assert get_index.resource_name not in [ | ||
index.resource_name for index in list_indexes | ||
] | ||
|
||
# Delete index endpoint and check that it is no longer listed | ||
my_index_endpoint.delete() | ||
assert my_index_endpoint.resource_name not in [ | ||
index_endpoint.resource_name | ||
for index_endpoint in aiplatform.MatchingEngineIndexEndpoint.list() | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had talked to Morgan before about some ideas to clean this up. This will get uglier as time passes.