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

feat: add wait for creation and more informative exception when properties are not available #566

Merged
merged 13 commits into from Jul 29, 2021

Conversation

sasha-gitg
Copy link
Member

Includes fixes to some properties.

@sasha-gitg sasha-gitg requested a review from a team as a code owner July 22, 2021 20:50
@product-auto-label product-auto-label bot added the api: aiplatform Issues related to the AI Platform API. label Jul 22, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 22, 2021
Copy link
Contributor

@vinnysenthil vinnysenthil 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 Sasha! Added a few questions.

@@ -255,6 +255,8 @@ def get_model_with_custom_project_mock():
get_model_mock.return_value = gca_model.Model(
display_name=_TEST_MODEL_NAME,
name=_TEST_MODEL_RESOURCE_NAME_CUSTOM_PROJECT,
artifact_uri=_TEST_ARTIFACT_URI,
description=_TEST_DESCRIPTION,
Copy link
Contributor

Choose a reason for hiding this comment

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

I presume these are being added to ensure that accessing these fields will still raise a RuntimeError if _gca_resource is not set?

Copy link
Member Author

Choose a reason for hiding this comment

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

These fields were added to test properties would return without throwing a RuntimeError if gca_resource is set, though these tests could have asserted for empty strings per underlying proto implementation so this may not be necessary.

google/cloud/aiplatform/base.py Outdated Show resolved Hide resolved
Comment on lines +1105 to +1112
while not getattr(self._gca_resource, "name", None):
# breaks out of loop if creation has failed async
if self._are_futures_done() and not getattr(
self._gca_resource, "name", None
):
self._raise_future_exception()

time.sleep(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this frequency of polling alright? Since it doesn't call the service I'm presuming so.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, it doesn't call the service. Also, when in this loop there is no _gca_resource available so the resource either hasn't been created yet or our creation request hasn't returned yet.

tests/unit/aiplatform/test_automl_tabular_training_jobs.py Outdated Show resolved Hide resolved
tests/unit/aiplatform/test_automl_tabular_training_jobs.py Outdated Show resolved Hide resolved
@sasha-gitg sasha-gitg merged commit e346117 into googleapis:master Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: aiplatform Issues related to the AI Platform API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants