MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

tpu/queuedResources/getQueuedResource.js:19–53  ·  view source on GitHub ↗
(tpuClient)

Source from the content-addressed store, hash-verified

17'use strict';
18
19async function main(tpuClient) {
20 // [START tpu_queued_resources_get]
21 // Import the TPUClient
22 // TODO(developer): Uncomment below line before running the sample.
23 // const {TpuClient} = require('@google-cloud/tpu').v2alpha1;
24
25 // Instantiate a tpuClient
26 // TODO(developer): Uncomment below line before running the sample.
27 // tpuClient = new TpuClient();
28
29 /**
30 * TODO(developer): Update these variables before running the sample.
31 */
32 // Project ID or project number of the Google Cloud project, where you want to retrive node.
33 const projectId = await tpuClient.getProjectId();
34
35 // The name of queued resource.
36 const queuedResourceName = 'queued-resource-1';
37
38 // The zone of your queued resource.
39 const zone = 'us-central1-a';
40
41 async function callGetQueuedResource() {
42 const request = {
43 name: `projects/${projectId}/locations/${zone}/queuedResources/${queuedResourceName}`,
44 };
45
46 const [response] = await tpuClient.getQueuedResource(request);
47
48 console.log(`Queued resource ${queuedResourceName} retrived.`);
49 return response;
50 }
51 return await callGetQueuedResource();
52 // [END tpu_queued_resources_get]
53}
54
55module.exports = main;
56

Callers

nothing calls this directly

Calls 2

callGetQueuedResourceFunction · 0.85
getProjectIdMethod · 0.80

Tested by

no test coverage detected