Skip to content

feat: Added sync argument in Matching Engine IndexEndpoint deploy_index #5305

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

Closed
wants to merge 11 commits into from

Conversation

KennyStryker
Copy link
Contributor

@KennyStryker KennyStryker commented May 8, 2025

✨ Add sync argument to deploy_index method in Matching Engine IndexEndpoint

Fixes #5304 🦕

Description

This PR introduces a new sync parameter to the deploy_index method, enabling both synchronous and asynchronous deployments. By default, the method remains synchronous to preserve backward compatibility.

Changes

  • Added a sync: bool = True argument to the deploy_index method.
  • If sync is True, the method waits for the long-running deployment operation (LRO) to complete before returning.
  • If sync is False, the method returns immediately, and the LRO completes in the background.
  • Maintains all existing behavior as default.

Usage Example

# Synchronous deployment (default behavior)
endpoint.deploy_index(index=my_index, deployed_index_id="my-index-id")

# Asynchronous deployment
endpoint.deploy_index(index=my_index, deployed_index_id="my-index-id", sync=False)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Get the necessary approvals
  • Once the last commit on the PR has been approved, add the "ready to pull" label to the Pull Request

Note: do not merge your PR from GitHub. Adding the "ready to pull" label is the final step in the review process.
After approvals, the changes in your PR will be committed to the main branch and this PR will be closed.

Copy link

google-cla bot commented May 8, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels May 8, 2025
@KennyStryker KennyStryker changed the title feat: Added sync argument in Matching Engine deploy_index feat: Added sync argument in Matching Engine IndexEndpoint deploy_index May 8, 2025
@KennyStryker
Copy link
Contributor Author

CLA Signed.

@jaycee-li jaycee-li added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels May 13, 2025
@matthew29tang matthew29tang added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 25, 2025
@matthew29tang matthew29tang requested a review from lingyinw June 25, 2025 23:24
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 25, 2025
Copy link

@ericgribkoff ericgribkoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I pointed to an existing decorator in our codebase that should be used to implement the desired behavior. This change also needs a test for the sync parameter behavior, something analogous to

def test_delete_index_endpoint(self, delete_index_endpoint_mock, sync):

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jun 26, 2025
@KennyStryker
Copy link
Contributor Author

KennyStryker commented Jun 26, 2025

@ericgribkoff Thank you for your response. I have added the requested changes, including the updated test cases for sync.

Copy link

@ericgribkoff ericgribkoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for addressing the earlier comments!

@ericgribkoff
Copy link

@matthew29tang Lingyin rerouted the review to me. Changes look good and approved from Vector Search team's side, but I don't have write access to this repository.

@matthew29tang
Copy link
Contributor

I will get this merged in then, thanks for the review!

@matthew29tang matthew29tang added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 26, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 26, 2025
@matthew29tang matthew29tang added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 26, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 26, 2025
@matthew29tang matthew29tang added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 26, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 26, 2025
@matthew29tang matthew29tang added the ready to pull Ready to be merged into the codebase. label Jun 26, 2025
copybara-service bot pushed a commit that referenced this pull request Jun 26, 2025
--
7135692 by Kenny Stryker <nggkenny@gmail.com>:

feat(matching-engine): add sync argument to deploy_index

--
e0eb35d by Kenny Stryker <nggkenny@gmail.com>:

feat: Updated explicit sync to existing decorator optional_sync

--
af64657 by Kenny Stryker <nggkenny@gmail.com>:

fix: Fixed return type for deploy_index and added test for sync values

--
4a1edb1 by Kenny Stryker <nggkenny@gmail.com>:

test: Added test cases for sync values in automatic config deploy index

--
b0d4e47 by Kenny Stryker <nggkenny@gmail.com>:

chore: Updated docstring for helper method _deploy_index
COPYBARA_INTEGRATE_REVIEW=#5305 from KennyStryker:main cc7ebe1
PiperOrigin-RevId: 776289436
@matthew29tang
Copy link
Contributor

Merged in fee1e2d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API. ready to pull Ready to be merged into the codebase. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Added sync argument in Matching Engine IndexEndpoint deploy_index
6 participants