Thanks to visit codestin.com
Credit goes to github.com

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ def deploy_index(
auth_config_audiences: Optional[Sequence[str]] = None,
auth_config_allowed_issuers: Optional[Sequence[str]] = None,
request_metadata: Optional[Sequence[Tuple[str, str]]] = (),
sync: bool = True,
deploy_request_timeout: Optional[float] = None,
psc_automation_configs: Optional[Sequence[Tuple[str, str]]] = None,
) -> "MatchingEngineIndexEndpoint":
Expand Down Expand Up @@ -1207,10 +1208,12 @@ def deploy_index(
auth_config_audiences and auth_config_allowed_issuers must be passed together.
request_metadata (Sequence[Tuple[str, str]]):
Optional. Strings which should be sent along with the request as metadata.

sync (bool):
Whether to execute this method synchronously. If False, this method
will be executed in concurrent Future and any downstream object will
be immediately returned and synced when the Future has completed.
deploy_request_timeout (float):
Optional. The timeout for the request in seconds.

psc_automation_configs (Sequence[Tuple[str, str]]):
Optional. A list of (project_id, network) pairs for Private
Service Connection endpoints to be setup for the deployed index.
Expand Down Expand Up @@ -1266,14 +1269,16 @@ def deploy_index(
"Deploy index", "index_endpoint", self.__class__, deploy_lro
)

deploy_lro.result(timeout=None)
# if sync then wait for any LRO to complete
if sync:
deploy_lro.result(timeout=None)

_LOGGER.log_action_completed_against_resource(
"index_endpoint", "Deployed index", self
)
_LOGGER.log_action_completed_against_resource(
"index_endpoint", "Deployed index", self
)

# update local resource
self._sync_gca_resource()
# update local resource
self._sync_gca_resource()

return self

Expand Down