- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2k
feat: tpu_queued_resources_startup_script/create_network/time_bound #3907
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
base: main
Are you sure you want to change the base?
Conversation
| Here is the summary of changes. You are about to add 3 region tags.
 This comment is generated by snippet-bot. 
 | 
3276b2a    to
    3ef4622      
    Compare
  
    83378d8    to
    cb97989      
    Compare
  
    e6c1d2c    to
    964cafb      
    Compare
  
    964cafb    to
    a66c4eb      
    Compare
  
    | Due to high costs of TPU Nodes, it was decided to use mocks in the tests. | 
a66c4eb    to
    9a724f9      
    Compare
  
    | @gemini review | 
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 pull request adds support for TPU queued resources and includes creating a network, startup script, and time-bound resource. The implementation looks good, and the tests are comprehensive. Here are a few suggestions:
- Consider adding more details to the PR description about the specific functionalities added and how they address the linked issue. This will help reviewers understand the context better.
- Ensure all TODO comments are addressed before merging.
- Update the README files to reflect the new functionalities added by this PR.
        
          
                .github/workflows/tpu.yaml
              
                Outdated
          
        
      | id-token: 'write' | ||
| if: github.event_name == 'schedule' && always() # always() submits logs even if tests fail | ||
| uses: ./.github/workflows/flakybot.yaml | ||
| needs: [test] No newline at end of file | 
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.
| // TODO(developer): Uncomment below line before running the sample. | ||
| // tpuClient = new TpuClient(); | 
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.
Consider instantiating the tpuClient here since you're suggesting to import the class above. This makes the example runnable.
| // TODO(developer): Uncomment below line before running the sample. | |
| // tpuClient = new TpuClient(); | |
| // Instantiate a tpuClient | |
| const tpuClient = new TpuClient(); | 
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 is commented, becuase mocked tpuClient is used for testing and I pass mock to this function. If user wants to use real TPUClient, they will need to uncomment this line
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.
Understood.  For clarity, perhaps a comment indicating that the tpuClient instantiation is for non-testing scenarios would be beneficial.  This would help users understand the purpose of the commented-out code more easily.
| // TODO(developer): Uncomment below line before running the sample. | |
| // tpuClient = new TpuClient(); | |
| // Instantiate a tpuClient (uncomment for non-testing scenarios) | |
| // const tpuClient = new TpuClient(); | 
| // TODO(developer): Uncomment below line before running the sample. | ||
| // const {TpuClient} = require('@google-cloud/tpu').v2alpha1; | 
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.
Since TpuClient is already imported in the tests, consider importing it here as well instead of relying on the parameter. This makes the code more self-contained and easier to understand.
| // TODO(developer): Uncomment below line before running the sample. | |
| // const {TpuClient} = require('@google-cloud/tpu').v2alpha1; | |
| const {TpuClient} = require('@google-cloud/tpu').v2alpha1; | |
| const {Node, NetworkConfig, QueuedResource} = require('@google-cloud/tpu').protos.google.cloud.tpu.v2alpha1; | 
| /** | ||
| * TODO(developer): Update/uncomment these variables before running the sample. | ||
| */ | 
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.
Update the TODO with instructions on how to set up the required environment variables or configuration.
| /** | |
| * TODO(developer): Update/uncomment these variables before running the sample. | |
| */ | |
| /** | |
| * TODO(developer): Before running the sample, | |
| * 1. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of your service account key file. | |
| * 2. Create a network named 'compute-tpu-network' in the 'europe-west4' region. | |
| * 3. Create a subnetwork with the same name as the network in the 'europe-west4' region. | |
| */ | 
        
          
                tpu/test/.eslintrc
              
                Outdated
          
        
      | @@ -0,0 +1,3 @@ | |||
| --- | |||
| env: | |||
| mocha: true No newline at end of file | |||
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.
d06385d    to
    23feb0f      
    Compare
  
    1a62542    to
    7362b9d      
    Compare
  
    | const networkName = 'compute-tpu-network'; | ||
|  | ||
| // The region of the network, that you want the node to connect to. | ||
| const region = 'europe-west4'; | 
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.
Same as in another PR, this value can be just taken from the zone value. No need to explicitly define.
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.
@m-strzelczyk fixed
7362b9d    to
    9f48401      
    Compare
  
    9f48401    to
    a9ee1f7      
    Compare
  
    | Hi @iennae, could you please take a look once again on this PR? cc: @rsamborski | 
| The users that are currently failing CLA had CLA signed at the time they were committing the changes. Please force-merge the PR. | 
| Can confirm the CLAs were signed per previous checks https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/3907/checks?check_run_id=34201685809 | 
| @m-strzelczyk Can you please re-review? Your previous review appears to not be valid any more. | 
Description
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
npm test(see Testing)npm run lint(see Style)GoogleCloudPlatform/nodejs-docs-samples. Not a fork.