-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(tpu): add tpu vm create topology sample. #9611
Conversation
As far as I understand the context of your comment, it is about my question of reusing the code sample The arguments like this (i.e. it is done this way in another code sample or in another language) do not show that it is right or wrong because we did many things in different way than we do today. To elaborate my question, please note that we use region tags to show code samples in the documentation. There is nothing that prevent showing the same code in two code snippets.My comment comes from the fact that these two codes are exactly the same except for a single line. It creates unnecessary maintenance overhead. |
Actually it is not a single line comment. We have different parameters and building chains to create Node. It will be not user friendly to have all these lines commented. |
@TetyanaYahodska I have looked at code from
It is easy to see that the only difference is in the code that calls
Taking into account what I explained above, I do not understand what you reference as "not user friendly". Note that neither of these code samples are currently used in any documentation. So, arguments about readability or friendliness can be made only based on the code. The fact is that it is not easy to spot the difference between these two calls ( I am going to approve this PR to unblock your progress. However, introducing almost exact code samples without documentation that provides the context and, possibly, elaborates the implementation details is not recommended practice. |
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.
the change introduces duplicated code samples.
@minherz I see your point, however I think in this situation, a separate code sample is justified. The difference in the middle - setting the accelerator config vs accelerator type - if packed inside a single method with if-else or something like that would complicate the sample. I really want to keep those samples as simple as possible, as with Java in particular, they do take up a lot of lines and might feel overwhelming. I know that the number of lines should not be a deciding factor, but introducing if-else into a sample that's supposed to do one specific thing does add a bit of friction for the user reading the sample. I'd like to point out an example in Python, where I did decide to keep reusing a single sample just adding various if-else blocks, since each one didn't seem worthy of forking to a new sample. The VM instance creation sample - a very simple operation grows to ~130 lines of code, handling various options and possibilities. If I were to do it again, I think I would rather duplicate some code to keep it all simpler. Both samples will be used on this page where the |
* Changed package, added information to CODEOWNERS * Added information to CODEOWNERS * Added timeout * Fixed parameters for test * Fixed DeleteTpuVm and naming * Added comment, created Util class * Fixed naming * Fixed whitespace * Split PR into smaller, deleted redundant code * Implemented tpu_vm_create_topology sample, created test * Changed zone * Fixed empty lines and tests, deleted cleanup method * Fixed tests * Fixed test * Fixed imports * Increased timeout to 10 sec * Fixed tests * Fixed tests * Deleted settings * Made ByteArrayOutputStream bout as local variable * Changed timeout to 10 sec
Description
Documentation - https://cloud.google.com/tpu/docs/managing-tpus-tpu-vm
Sample in Python - GoogleCloudPlatform/python-docs-samples#12719
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
pom.xml
parent set to latestshared-configuration
mvn clean verify
requiredmvn -P lint checkstyle:check
requiredmvn -P lint clean compile pmd:cpd-check spotbugs:check
advisory only