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: Added aiplatform.Model.update method #952

Merged
merged 12 commits into from Jan 24, 2022

Conversation

ivanmkc
Copy link
Contributor

@ivanmkc ivanmkc commented Jan 11, 2022

Added ability to update display_name, description and labels.

Fixes https://b.corp.google.com/issues/213921337

TODO

  • Manual test
  • Automated unit test
  • Automated integration test

Test code


models = Model.list()

my_model = models[0]

print(f"eTag: {my_model._gca_resource.etag}")
print(f"Current display_name: {my_model.display_name}")
my_model = my_model.update(display_name=my_model.display_name + "_new")
print(f"Current display_name: {my_model.display_name}")

print(f"eTag: {my_model._gca_resource.etag}")
my_model = Model(my_model.resource_name)  # Fetch model from server
print(f"eTag after fetch: {my_model._gca_resource.etag}")
print(f"Current description: {my_model.description}")
my_model = my_model.update(description=my_model.description + "_new")
print(f"Current description: {my_model.description}")

print(f"eTag: {my_model._gca_resource.etag}")
my_model = Model(my_model.resource_name)  # Fetch model from server
print(f"eTag after fetch: {my_model._gca_resource.etag}")
print(f"Current labels: {my_model.labels}")
my_model = my_model.update(labels={"my_label": "updated"})
print(f"Current labels: {my_model.labels}")

Bug?

There's some weirdness going on with the eTags though. If I don't "refetch" the model from the server, I get an "etag mismatch" exception on the subsequent update.

Tracked at b/214432914

@ivanmkc ivanmkc changed the title Added model.update method WIP: Added model.update method Jan 11, 2022
@ivanmkc ivanmkc changed the title WIP: Added model.update method Added model.update method Jan 13, 2022
@ivanmkc ivanmkc changed the title Added model.update method feat: Added model.update method Jan 13, 2022
@ivanmkc ivanmkc linked an issue Jan 13, 2022 that may be closed by this pull request
Copy link
Member

@sasha-gitg sasha-gitg left a comment

Choose a reason for hiding this comment

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

Please add or update an integration test to use this method:

An additional test case can be added here using the same model: https://github.com/googleapis/python-aiplatform/blob/main/tests/system/aiplatform/test_model_upload.py

It can also be added to this e2e test: https://github.com/googleapis/python-aiplatform/blob/main/tests/system/aiplatform/test_e2e_tabular.py

google/cloud/aiplatform/models.py Show resolved Hide resolved
google/cloud/aiplatform/models.py Show resolved Hide resolved
google/cloud/aiplatform/models.py Outdated Show resolved Hide resolved
Copy link
Member

@sasha-gitg sasha-gitg left a comment

Choose a reason for hiding this comment

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

LGTM!

google/cloud/aiplatform/models.py Outdated Show resolved Hide resolved
Co-authored-by: sasha-gitg <44654632+sasha-gitg@users.noreply.github.com>
@sasha-gitg sasha-gitg changed the title feat: Added model.update method feat: Added aiplatform.Model.update method Jan 24, 2022
@ivanmkc ivanmkc merged commit 44e208a into googleapis:main Jan 24, 2022
gcf-merge-on-green bot pushed a commit that referenced this pull request Jan 27, 2022
Fixed bug in integration test introduced by #952
ivanmkc added a commit to ivanmkc/python-aiplatform that referenced this pull request Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update asset labels of vertex ai models
2 participants