feature: Use gca_resource as repr and provide informative repr if asynchronous#291
Merged
Conversation
vinnysenthil
approved these changes
Apr 6, 2021
Contributor
vinnysenthil
left a comment
There was a problem hiding this comment.
LGTM, just one comment covering some concerns
| return self._gca_resource.display_name | ||
|
|
||
| def __repr__(self) -> str: | ||
| return repr(self._gca_resource) |
Contributor
There was a problem hiding this comment.
Will we eventually replace this with a prettier representation when time permits?
Another concern is users trying to access fields shown in _gca_resource, for example:
ds = aiplatform.Dataset('7529226928591470592')
dsname: "projects/580378083368/locations/us-central1/datasets/7529226928591470592"
display_name: "test_dataset_display_name"
metadata_schema_uri: "gs://google-cloud-aiplatform/schema/dataset/metadata/image_1.0.0.yaml"
create_time {
seconds: 1617354353
nanos: 956444000
}
update_time {
seconds: 1617354361
nanos: 707254000
}
etag: "AMEw9yMYcQqy2DwtHCx2ObYHK52UFD7YsBNGZnYRA-d7Fnau376JsgwTnBkrqtBb8CXk"
labels {
key: "aiplatform.googleapis.com/dataset_metadata_schema"
value: "IMAGE"
}
metadata {
struct_value {
fields {
key: "dataItemSchemaUri"
value {
string_value: "gs://google-cloud-aiplatform/schema/dataset/dataitem/image_1.0.0.yaml"
}
}
fields {
key: "gcsBucket"
value {
string_value: "cloud-ai-platform-62f88573-082b-416d-a1b7-e47dcc520767"
}
}
}
}
ds.labels
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-7ef790277785> in <module>
----> 1 ds.labels
AttributeError: 'Dataset' object has no attribute 'labels'
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes b/182290998 🦕