diff --git a/tpu/queuedResource/createQueuedResource.js b/tpu/queuedResource/createQueuedResource.js index b2d3bc99803..05059da209c 100644 --- a/tpu/queuedResource/createQueuedResource.js +++ b/tpu/queuedResource/createQueuedResource.js @@ -111,24 +111,6 @@ async function main( await operation.promise(); console.log(`Queued resource ${queuedResourceName} created.`); - - const getNodeRequest = { - name: `projects/${projectId}/locations/${zone}/nodes/${nodeName}`, - }; - - console.log(`Waiting for TPU node ${nodeName} to become ready...`); - - // Poll for TPU node state every 30 seconds - const intervalId = setInterval(async () => { - const [node] = await tpuClient.getNode(getNodeRequest); - - if (node.state === 'READY') { - clearInterval(intervalId); - console.log(`TPU node ${nodeName} is ready.`); - } else { - console.log(`TPU node ${nodeName} is in state: ${node.state}`); - } - }, 30000); } await callCreateQueuedResource(); // [END tpu_queued_resources_create] diff --git a/tpu/queuedResource/deleteQueuedResource.js b/tpu/queuedResource/deleteQueuedResource.js index a3e03cc8215..33809c46574 100644 --- a/tpu/queuedResource/deleteQueuedResource.js +++ b/tpu/queuedResource/deleteQueuedResource.js @@ -36,31 +36,11 @@ async function main(queuedResourceName, zone) { // The zone of your queued resource. // zone = 'europe-west4-a'; - async function callDeleteTpuVM(nodeName) { - const request = { - name: `projects/${projectId}/locations/${zone}/nodes/${nodeName}`, - }; - - const [operation] = await tpuClient.deleteNode(request); - - // Wait for the delete operation to complete. - await operation.promise(); - - console.log(`Node: ${nodeName} deleted.`); - } - async function callDeleteQueuedResource() { const request = { name: `projects/${projectId}/locations/${zone}/queuedResources/${queuedResourceName}`, }; - // Retrive node name - const [response] = await tpuClient.getQueuedResource(request); - const nodeName = response.tpu.nodeSpec[0].nodeId; - - // Before deleting the queued resource it is required to delete the TPU VM. - await callDeleteTpuVM(nodeName); - const [operation] = await tpuClient.deleteQueuedResource(request); // Wait for the delete operation to complete. diff --git a/tpu/test/queuedResource.test.js b/tpu/test/queuedResource.test.js index 1e242344227..2066e6c6b3d 100644 --- a/tpu/test/queuedResource.test.js +++ b/tpu/test/queuedResource.test.js @@ -24,7 +24,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); -describe('TPU queued resource', async () => { +describe('TPU queued resource', () => { const queuedResourceName = `queued-resource-name-1a2sdf${Math.floor(Math.random() * 1000 + 1)}`; const nodePrefix = 'node-name-2a2b3c'; const nodeName = `${nodePrefix}${Math.floor(Math.random() * 1000 + 1)}`; @@ -32,7 +32,7 @@ describe('TPU queued resource', async () => { const tpuType = 'v2-8'; const tpuSoftwareVersion = 'tpu-vm-tf-2.14.1'; - it('should create a new queued resource', () => { + it('should create a new queued resource', async () => { const response = execSync( `node ./queuedResource/createQueuedResource.js ${nodeName} ${queuedResourceName} ${zone} ${tpuType} ${tpuSoftwareVersion}`, {