Skip to content
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

migrate code from googleapis/nodejs-dataproc #2878

Merged
merged 101 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
8217a27
enabling test and CI
alexander-fenster Dec 19, 2017
0def768
Upgrade repo-tools and regenerate scaffolding.
jmdobry Mar 16, 2018
5fa39eb
make lint task work in circleci
alexander-fenster Mar 16, 2018
e671ee9
update lock files
callmehiphop Mar 19, 2018
5a1c4b8
chore: make samples depend on the current version
alexander-fenster Mar 20, 2018
8cd7402
chore: make samples depend on the current version
alexander-fenster Mar 20, 2018
4b6db4e
regen package-lock
alexander-fenster Mar 21, 2018
fd0c436
chore: lock files maintenance (#19)
alexander-fenster May 2, 2018
6d322b1
chore: lock files maintenance (#21)
alexander-fenster May 8, 2018
366fa54
chore: lock files maintenance (#24)
alexander-fenster May 22, 2018
3b9c83a
fix: update all dependencies
JustinBeckwith Jun 1, 2018
67343d4
chore: update sample lockfiles (#33)
JustinBeckwith Jun 25, 2018
70b5042
chore(deps): lock file maintenance (#36)
renovate[bot] Jul 3, 2018
08b5547
chore(deps): lock file maintenance (#39)
renovate[bot] Jul 10, 2018
2f99d58
fix: drop support for node.js 4.x and 9.x (#38)
JustinBeckwith Jul 10, 2018
d270892
chore(deps): lock file maintenance (#40)
renovate[bot] Jul 10, 2018
6bb66df
chore(deps): lock file maintenance (#41)
renovate[bot] Jul 10, 2018
a7c4813
chore(deps): update dependency @google-cloud/nodejs-repo-tools to v2.…
renovate[bot] Jul 12, 2018
e65a711
chore(deps): lock file maintenance (#46)
renovate[bot] Jul 17, 2018
ea0b43e
chore(deps): lock file maintenance (#50)
renovate[bot] Jul 24, 2018
a2c545c
chore: require node 8 for samples (#53)
JustinBeckwith Jul 30, 2018
330c1ba
chore(deps): lock file maintenance (#54)
renovate[bot] Jul 31, 2018
bba8a50
chore(deps): lock file maintenance (#59)
renovate[bot] Aug 7, 2018
b232fd9
chore: ignore package-lock.json (#61)
JustinBeckwith Aug 7, 2018
2a33e4f
Remove unused dependencies (#76)
JustinBeckwith Sep 5, 2018
4a68d2c
Release v0.3.0 (#87)
JustinBeckwith Sep 25, 2018
ca5ab33
chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 …
renovate[bot] Nov 10, 2018
9198821
docs(samples): updated samples code to use async await (#120)
praveenqlogic Nov 22, 2018
7896db3
test: add a sample test (#143)
JustinBeckwith Dec 19, 2018
c70c6fb
Release v0.4.0 (#146)
jkwlui Jan 8, 2019
cb08679
chore(deps): update dependency mocha to v6
renovate[bot] Feb 19, 2019
45da3c5
Release v0.5.0 (#174)
JustinBeckwith Mar 10, 2019
23c0845
refactor: use execSync for tests
JustinBeckwith Apr 4, 2019
4ab9886
refactor: wrap execSync with encoding: utf-8 (#188)
jkwlui Apr 5, 2019
729ae93
docs: update README and add repo metadata (#191)
JustinBeckwith Apr 23, 2019
fac83ef
chore: release 1.0.0 (#210)
yoshi-automation May 20, 2019
368832d
chore: release 1.1.0 (#216)
yoshi-automation May 24, 2019
717d39c
chore: release 1.2.0 (#223)
yoshi-automation Jun 5, 2019
79a8cbd
chore: release 1.2.1 (#227)
yoshi-automation Jun 14, 2019
553730b
chore: release 1.2.2 (#231)
yoshi-automation Jun 27, 2019
d4d260a
chore: release 1.2.3 (#239)
yoshi-automation Aug 5, 2019
2c08fd6
chore: release 1.2.4 (#241)
yoshi-automation Aug 26, 2019
eb7614f
chore: release 1.3.0 (#245)
yoshi-automation Sep 16, 2019
605413e
chore: release 1.4.1 (#262)
release-please[bot] Oct 22, 2019
ce3e239
docs(sample): added create cluster sample for cloud dataproc (#266)
bradmiro Nov 14, 2019
83b858a
chore: release 1.4.2 (#265)
release-please[bot] Nov 16, 2019
0170f9e
fix: change dataproc success message and test (#269)
bradmiro Nov 18, 2019
bcc6898
fix(deps): update dependency yargs to v15 (#271)
renovate-bot Nov 18, 2019
4674f7a
chore: release 1.4.3 (#272)
release-please[bot] Nov 18, 2019
0026d80
chore: update license headers
JustinBeckwith Nov 25, 2019
12e5c3a
chore: release 1.4.4 (#275)
release-please[bot] Dec 5, 2019
b91b58e
refactor: use explicit mocha imports (#281)
JustinBeckwith Dec 30, 2019
3e734c9
fix: overhauled quickstart (#280)
bradmiro Dec 30, 2019
4525c9b
chore(deps): update dependency mocha to v7 (#283)
renovate-bot Jan 6, 2020
a0368df
chore: release 1.4.5
release-please[bot] Jan 6, 2020
516d481
chore: release 1.4.6 (#286)
release-please[bot] Jan 17, 2020
728bc54
chore: release 1.4.7 (#292)
release-please[bot] Jan 31, 2020
e5b8974
feat: added cli functionality to dataproc quickstart sample (#291)
bradmiro Feb 4, 2020
eaa3639
chore: release 1.5.0 (#298)
release-please[bot] Feb 5, 2020
4d0546e
chore: release 1.6.0 (#303)
release-please[bot] Feb 10, 2020
c5404cb
feat!: convert dataproc to typescript (#310)
summer-ji-eng Feb 29, 2020
b2607bc
chore: update UUID dependency (#330)
bcoe Mar 19, 2020
00df148
feat: adding sample for instantiate inline workflow template (#335)
bradmiro Mar 24, 2020
25b1c09
fix: reformat samples with sample-metadata (#343)
bradmiro Apr 2, 2020
50e4a3c
chore: linting
yoshi-automation Apr 20, 2020
982f595
test: address flaky system test (#364)
bcoe Apr 20, 2020
42028c7
chore(deps): update dependency uuid to v8 (#370)
renovate-bot May 1, 2020
6b37e0b
test: quickstart sometimes has service failures (#369)
bcoe May 9, 2020
f4a6c68
chore: release 2.0.0 (#321)
release-please[bot] May 9, 2020
b8fb7de
fix(deps): update dependency @google-cloud/storage to v5 (#380)
renovate-bot May 15, 2020
9bd9a97
chore(deps): update dependency mocha to v8 (#390)
renovate-bot Jun 11, 2020
4e8557e
chore: release 2.1.0 (#389)
release-please[bot] Jun 29, 2020
bc33ba3
chore(samples): no native sleep (#396)
alexander-fenster Jul 8, 2020
0614beb
chore: release 2.1.1 (#411)
release-please[bot] Jul 28, 2020
342f9ef
chore: release 2.2.0 (#418)
release-please[bot] Jul 31, 2020
3302b13
docs: submit job sample + sample maintenance (#449)
bradmiro Nov 30, 2020
9d03432
chore: release 2.2.1 (#448)
release-please[bot] Jan 12, 2021
0ac7469
chore: release 2.3.0 (#457)
release-please[bot] Jan 14, 2021
aa51ae0
docs: (samples) fixing samples for new machine types (#467)
bradmiro Mar 29, 2021
1b0cd08
chore: release 2.4.0 (#482)
release-please[bot] Apr 28, 2021
7ce14ad
chore: new owl bot post processor docker image (#488)
gcf-owl-bot[bot] May 10, 2021
4708d48
chore: release 2.4.1 (#487)
release-please[bot] May 13, 2021
483e9df
chore: release 2.4.2 (#496)
release-please[bot] Jun 3, 2021
68cde3f
chore: release 2.4.3 (#505)
release-please[bot] Jun 29, 2021
0c4ceb0
chore: release 2.4.4 (#522)
release-please[bot] Aug 17, 2021
d0a3435
chore: release 2.5.0 (#526)
release-please[bot] Sep 7, 2021
86da7f9
chore: release 3.0.0 (#533)
release-please[bot] Oct 6, 2021
0244cc1
feat: add Dataproc Serverless for Spark Batches API (#543)
gcf-owl-bot[bot] Oct 13, 2021
3189b48
chore: release 3.1.0 (#544)
release-please[bot] Oct 13, 2021
80622b9
chore: release 3.2.0 (#547)
release-please[bot] Oct 19, 2021
46c9e4f
build!: update library to use Node 12 (#589)
alexander-fenster May 13, 2022
eb106e7
chore(main): release 4.0.0 (#590)
release-please[bot] May 18, 2022
e046200
fix(deps): update dependency @google-cloud/storage to v6 (#592)
renovate-bot Jun 20, 2022
d6a4405
chore(main): release 4.0.1 (#593)
release-please[bot] Jun 30, 2022
6d14feb
fix: allow passing gax instance to client constructor (#612)
gcf-owl-bot[bot] Sep 8, 2022
8590b90
chore(deps): update dependency uuid to v9 (#619)
renovate-bot Sep 9, 2022
198978f
fix(deps): roll back dependency @google-cloud/dataproc to ^4.0.0 (#627)
renovate-bot Sep 22, 2022
db5ff7a
chore(main): release 4.1.0 (#600)
release-please[bot] Sep 26, 2022
6e4c968
chore(main): release 4.1.1 (#633)
release-please[bot] Nov 11, 2022
960f45a
Merge remote-tracking branch 'migration/main' into nodejs-dataproc-mi…
NimJay Nov 19, 2022
81e4b73
Generate dataproc.yaml
NimJay Nov 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/dataproc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: dataproc
on:
push:
branches:
- main
paths:
- 'dataproc/**'
pull_request:
paths:
- 'dataproc/**'
pull_request_target:
types: [labeled]
paths:
- 'dataproc/**'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: '[email protected]'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/[email protected]
with:
node-version: 16
- run: npm install
working-directory: dataproc
- run: npm test
working-directory: dataproc
env:
MOCHA_REPORTER_SUITENAME: dataproc
MOCHA_REPORTER_OUTPUT: dataproc_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
1 change: 1 addition & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"datacatalog/cloud-client",
"datacatalog/snippets",
"datalabeling",
"dataproc",
"datastore/functions",
"datacatalog/quickstart",
"dialogflow",
Expand Down
3 changes: 3 additions & 0 deletions dataproc/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
rules:
no-console: off
74 changes: 74 additions & 0 deletions dataproc/createCluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Create a Dataproc cluster with the Node.js Client Library.

// sample-metadata:
// title: Create Cluster
// usage: node createCluster.js <PROJECT_ID> <REGION> <CLUSTER_NAME>

/*eslint no-warning-comments: [0, { "terms": ["todo", "fixme"], "location": "anywhere" }]*/

function main(
projectId = 'YOUR_PROJECT_ID',
region = 'YOUR_CLUSTER_REGION',
clusterName = 'YOUR_CLUSTER_NAME'
) {
// [START dataproc_create_cluster]
const dataproc = require('@google-cloud/dataproc');

// TODO(developer): Uncomment and set the following variables
// projectId = 'YOUR_PROJECT_ID'
// region = 'YOUR_CLUSTER_REGION'
// clusterName = 'YOUR_CLUSTER_NAME'

// Create a client with the endpoint set to the desired cluster region
const client = new dataproc.v1.ClusterControllerClient({
apiEndpoint: `${region}-dataproc.googleapis.com`,
projectId: projectId,
});

async function createCluster() {
// Create the cluster config
const request = {
projectId: projectId,
region: region,
cluster: {
clusterName: clusterName,
config: {
masterConfig: {
numInstances: 1,
machineTypeUri: 'n1-standard-2',
},
workerConfig: {
numInstances: 2,
machineTypeUri: 'n1-standard-2',
},
},
},
};

// Create the cluster
const [operation] = await client.createCluster(request);
const [response] = await operation.promise();

// Output a success message
console.log(`Cluster created successfully: ${response.clusterName}`);
// [END dataproc_create_cluster]
}

createCluster();
}

main(...process.argv.slice(2));
97 changes: 97 additions & 0 deletions dataproc/instantiateInlineWorkflowTemplate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This sample instantiates an inline workflow template using the client
// library for Dataproc.

// sample-metadata:
// title: Instantiate an inline workflow template
// usage: node instantiateInlineWorkflowTemplate.js <PROJECT_ID> <REGION>

/*eslint no-warning-comments: [0, { "terms": ["todo", "fixme"], "location": "anywhere" }]*/

async function main(projectId = 'YOUR_PROJECT_ID', region = 'YOUR_REGION') {
// [START dataproc_instantiate_inline_workflow_template]
const dataproc = require('@google-cloud/dataproc');

// TODO(developer): Uncomment and set the following variables
// projectId = 'YOUR_PROJECT_ID'
// region = 'YOUR_REGION'

// Create a client with the endpoint set to the desired region
const client = new dataproc.v1.WorkflowTemplateServiceClient({
apiEndpoint: `${region}-dataproc.googleapis.com`,
projectId: projectId,
});

async function instantiateInlineWorkflowTemplate() {
// Create the formatted parent.
const parent = client.regionPath(projectId, region);

// Create the template
const template = {
jobs: [
{
hadoopJob: {
mainJarFileUri:
'file:///usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar',
args: ['teragen', '1000', 'hdfs:///gen/'],
},
stepId: 'teragen',
},
{
hadoopJob: {
mainJarFileUri:
'file:///usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar',
args: ['terasort', 'hdfs:///gen/', 'hdfs:///sort/'],
},
stepId: 'terasort',
prerequisiteStepIds: ['teragen'],
},
],
placement: {
managedCluster: {
clusterName: 'my-managed-cluster',
config: {
gceClusterConfig: {
// Leave 'zoneUri' empty for 'Auto Zone Placement'
// zoneUri: ''
zoneUri: 'us-central1-a',
},
},
},
},
};

const request = {
parent: parent,
template: template,
};

// Submit the request to instantiate the workflow from an inline template.
const [operation] = await client.instantiateInlineWorkflowTemplate(request);
await operation.promise();

// Output a success message
console.log('Workflow ran successfully.');
// [END dataproc_instantiate_inline_workflow_template]
}

instantiateInlineWorkflowTemplate();
}

main(...process.argv.slice(2)).catch(err => {
console.error(err);
process.exitCode = 1;
});
25 changes: 25 additions & 0 deletions dataproc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "nodejs-docs-samples-dataproc",
"license": "Apache-2.0",
"author": "Google Inc.",
"files": [
"*.js"
],
"engines": {
"node": ">=12.0.0"
},
"repository": "googleapis/nodejs-dataproc",
"private": true,
"scripts": {
"test": "mocha system-test --timeout 600000"
},
"dependencies": {
"@google-cloud/dataproc": "^4.1.1",
"@google-cloud/storage": "^6.0.0"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^8.0.0",
"uuid": "^9.0.0"
}
}
Loading