-
Notifications
You must be signed in to change notification settings - Fork 2.9k
a small sample to create a managed notebook using the Java SDK #7532
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
Conversation
|
Hi there Les! Looking forward to your review. |
lesv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work, but really you can simplify things for the user and yourself.
| Project ID | ||
| Project Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use ADC? Ideally gcloud auth login or gcloud auth application-default login should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good point. The code used to require them. I fixed it in the code but forgot to update the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I still see references to PROJECT_ID and PROJECT_NUMBER in the docs, for instance:
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
--member="serviceAccount:${PROJECT_NUMBER}[email protected]" \
--role="roles/notebooks.admin"
| private static String serviceAccount = "[email protected]"; | ||
| private static String parentProject = "projects/example-project-id/locations/us-central1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these hard coded?
You can get them from ADC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Can you provide an example? I didn't see anything helpful at that linked URL and I couldn't find it with what felt like reasonable queries.
| directory with the value of $(eval echo | ||
| "io.grpc.internal.PickFirstLoadBalancerProvider") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be inside backticks? (code font)
| . | ||
|
|
||
| In order to set a default load balancer provider, this maven package has a file | ||
| called io.grpc.LoadBalancerProvider in the java-docs-samples/vertex-ai/managed_notebook/src/main/resources/META-INF/services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you highlight the path?
| directory with the value of $(eval echo | ||
| "io.grpc.internal.PickFirstLoadBalancerProvider") | ||
|
|
||
| - https://stackoverflow.com/questions/55484043/how-to-fix-could-not-find-policy-pick-first-with-google-tts-java-client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you would want to explain a bit more what the problem is here, and why you picked this solution. (and why they might choose another one in other circumstances)
| `mvn clean compile` | ||
|
|
||
| - [To include all dependencies in this .jar | ||
| file](https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-runnable-jar-with-dependencies-using-maven), | ||
| you would run the following: | ||
|
|
||
| `mvn assembly:single` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to get away with just using mvn clean package
| Be sure that you have granted the notebooks.runtimes.create permission to your | ||
| service account. The roles/notebooks.admin role includes this permission, but | ||
| may be too permissive. If this is the case, consider creating a new role with | ||
| only the permissions necessary. The following is an example of granting the | ||
| notebooks.admin role: | ||
|
|
||
| ```bash | ||
| gcloud projects add-iam-policy-binding ${PROJECT_ID} \ | ||
| --member="serviceAccount:${PROJECT_NUMBER}[email protected]" \ | ||
| --role="roles/notebooks.admin" | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you chose this over using gcloud auth application-default login ? We are now setting the billing project with it, or you can at least add that option. It simplifies things, but it's not a production option, but it might better guide production.
For production, you don't want to hard code service accounts, you either get them through an envVar or better from the Metadata server.
| <maven.compiler.source>1.7</maven.compiler.source> | ||
| <maven.compiler.target>1.7</maven.compiler.target> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely shouldn't be 1.7, 11 is a better choice these days.
| <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> | ||
| <plugin> | ||
| <artifactId>maven-site-plugin</artifactId> | ||
| <version>3.7.1</version> | ||
| </plugin> | ||
| <plugin> | ||
| <artifactId>maven-project-info-reports-plugin</artifactId> | ||
| <version>3.0.0</version> | ||
| </plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit excessive.
|
The key things:
|
|
Please reopen when development restarts, thanks! |
Fixes customer issue
An example of how to create a vertex-ai managed notebook using the Java SDK