-
Notifications
You must be signed in to change notification settings - Fork 6.5k
fix: add mains to samples #3284
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
Changes from 10 commits
5557be9
9740aab
08e06e7
b760c46
821e407
1f615a2
d15e2d1
a961de3
51ef9fa
75cc885
c041db7
46991f4
f526bc8
0dbf815
edb489c
49023a8
881bc90
cc520db
bbe372e
8ccb874
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,12 @@ | |
|
||
# This sample walks a user through creating a Cloud Dataproc cluster using | ||
# the Python client library. | ||
# | ||
# This script can be run on its own: | ||
# python create_cluster.py ${PROJECT_ID} ${REGION} ${CLUSTER_NAME} | ||
|
||
|
||
import sys | ||
|
||
# [START dataproc_create_cluster] | ||
from google.cloud import dataproc_v1 as dataproc | ||
|
@@ -33,7 +39,7 @@ def create_cluster(project_id, region, cluster_name): | |
|
||
# Create a client with the endpoint set to the desired cluster region. | ||
cluster_client = dataproc.ClusterControllerClient(client_options={ | ||
'api_endpoint': '{}-dataproc.googleapis.com:443'.format(region) | ||
'api_endpoint': '{}-dataproc.googleapis.com:443'.format(region), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit should we be using f-strings instead of |
||
}) | ||
|
||
# Create the cluster config. | ||
|
@@ -59,3 +65,13 @@ def create_cluster(project_id, region, cluster_name): | |
# Output a success message. | ||
print('Cluster created successfully: {}'.format(result.cluster_name)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another potential f-string spot |
||
# [END dataproc_create_cluster] | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 4: | ||
sys.exit('python create_cluster.py project_id region cluster_name') | ||
|
||
project_id = sys.argv[1] | ||
region = sys.argv[2] | ||
cluster_name = sys.argv[3] | ||
create_cluster(project_id, region, cluster_name) | ||
bradmiro marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,11 @@ | |
# workflow for Cloud Dataproc using the Python client library. | ||
# | ||
# This script can be run on its own: | ||
# python workflows.py ${PROJECT_ID} ${REGION} | ||
# python instantiate_inline_workflow_template.py ${PROJECT_ID} ${REGION} | ||
|
||
|
||
import sys | ||
|
||
# [START dataproc_instantiate_inline_workflow_template] | ||
from google.cloud import dataproc_v1 as dataproc | ||
|
||
|
@@ -91,8 +93,14 @@ def instantiate_inline_workflow_template(project_id, region): | |
|
||
# Output a success message. | ||
print('Workflow ran successfully.') | ||
# [END dataproc_instantiate_inline_workflow_template] | ||
# [END dataproc_instantiate_inline_workflow_template] | ||
|
||
|
||
if __name__ == "__main__": | ||
instantiate_inline_workflow_template(sys.argv[1], sys.argv[2]) | ||
if len(sys.argv) < 3: | ||
sys.exit('python instantiate_inline_workflow_template.py ' | ||
+ 'project_id region') | ||
|
||
project_id = sys.argv[1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
region = sys.argv[2] | ||
instantiate_inline_workflow_template(project_id, region) |
Uh oh!
There was an error while loading. Please reload this page.