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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added the VertexAiResourceNoun.to_dict() method #588

Merged
merged 7 commits into from Aug 9, 2021

Conversation

Ark-kun
Copy link
Contributor

@Ark-kun Ark-kun commented Aug 3, 2021

This method allows getting the resource metadata as a standard Python dictionary.
Without this method, any user who would want to do this would have to access private fields.

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)

Fixes #<issue_number_goes_here> 馃

@product-auto-label product-auto-label bot added the api: aiplatform Issues related to the AI Platform API. label Aug 3, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 3, 2021
@Ark-kun Ark-kun changed the title Added the VertexAiResourceNoun.to_dict() method feat: Added the VertexAiResourceNoun.to_dict() method Aug 3, 2021
This method allows getting the resource metadata as a standard Python dictionary.
Without this method, any user who would want to do this would have to access private fields.
google/cloud/aiplatform/base.py Outdated Show resolved Hide resolved
@Ark-kun Ark-kun requested review from a team as code owners August 5, 2021 20:56
Copy link
Contributor

@ivanmkc ivanmkc left a comment

Choose a reason for hiding this comment

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

LGTM

Just wondering, what are the use cases are for exposing the internal resource metadata like this. Would it be better to create getters for each field we want to expose?

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Aug 6, 2021

Just wondering, what are the use cases are for exposing the internal resource metadata like this. Would it be better to create getters for each field we want to expose?

The aiplatform module is higher-level compared to the underlying API and gapic. Not everything is exposed.
I'm not sure manually adding all properties is fully maintainable.
In my case I wanted to return the full resource description in an industry standard JSON format that can easily be parsed and queried by any downstream tools.
When you want to "pass" a small resource description between different containers or components, using a format like JSON has many portability benefits. Adding .to_dict() makes it easy to "export" and serialize the resource description.

@sasha-gitg sasha-gitg added the automerge Merge the pull request once unit tests and other checks pass. label Aug 6, 2021
@gcf-merge-on-green
Copy link
Contributor

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 6, 2021
@Ark-kun
Copy link
Contributor Author

Ark-kun commented Aug 8, 2021

It looks like one of the tests has flaked. Is it possible to retry it?

@sasha-gitg sasha-gitg added the automerge Merge the pull request once unit tests and other checks pass. label Aug 9, 2021
@sasha-gitg sasha-gitg merged commit b478075 into googleapis:master Aug 9, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 9, 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

4 participants