Skip to content

Commit

Permalink
refactor: sleep timer (#400)
Browse files Browse the repository at this point in the history
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/cc99acfa-05b8-434b-9500-2f6faf2eaa02/targets

- [ ] To automatically regenerate this PR, check this box.
  • Loading branch information
yoshi-automation authored Jul 10, 2020
1 parent 7b71e77 commit c54c61d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
9 changes: 6 additions & 3 deletions packages/google-cloud-dataproc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ function main(projectId, region, clusterName, jobFilePath) {
const dataproc = require('@google-cloud/dataproc');
const {Storage} = require('@google-cloud/storage');

const sleep = require('sleep');

// Create a cluster client with the endpoint set to the desired cluster region
const clusterClient = new dataproc.v1.ClusterControllerClient({
apiEndpoint: `${region}-dataproc.googleapis.com`,
Expand Down Expand Up @@ -149,7 +147,7 @@ function main(projectId, region, clusterName, jobFilePath) {
);
break;
}
await sleep.sleep(1);
await sleep(1);
[jobResp] = await jobClient.getJob(jobReq);
}

Expand Down Expand Up @@ -187,6 +185,11 @@ function main(projectId, region, clusterName, jobFilePath) {
quickstart();
}

// Helper function to sleep for the given number of seconds
function sleep(seconds) {
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
}

const args = process.argv.slice(2);

if (args.length !== 4) {
Expand Down
12 changes: 10 additions & 2 deletions packages/google-cloud-dataproc/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
{
"git": {
"name": ".",
"remote": "[email protected]:googleapis/nodejs-dataproc.git",
"sha": "665679481d8175126a24bfc3e3cc12b65df676a4"
"remote": "https://github.com/googleapis/nodejs-dataproc.git",
"sha": "9f96dc932e54f76ea997a9a9de9d23948e6b236e"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "4f4aa3a03e470f1390758b9d89eb1aa88837a5be",
"internalRef": "320300472"
}
},
{
Expand Down

0 comments on commit c54c61d

Please sign in to comment.