Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,28 @@ def teardown():
max_tries=5,
)
def test_workflows(capsys):
# Setup driver node group cluster. TODO: cleanup b/424371877
command = f"""gcloud dataproc clusters create {CLUSTER_NAME} \
--region {REGION} \
--project {PROJECT_ID} \
--driver-pool-size=1 \
--driver-pool-id=pytest"""

output = subprocess.run(
command,
capture_output=True,
shell=True,
check=True,
)
print(output)
try:
# Setup driver node group cluster. TODO: cleanup b/424371877
command = f"""gcloud dataproc clusters create {CLUSTER_NAME} \
--region {REGION} \
--project {PROJECT_ID} \
--driver-pool-size=1 \
--driver-pool-id=pytest"""

# Wrapper function for client library function
submit_pyspark_job_to_driver_node_group_cluster.submit_job(
PROJECT_ID, REGION, CLUSTER_NAME
)
output = subprocess.run(
command,
capture_output=True,
shell=True,
check=True,
)
print(output)

out, _ = capsys.readouterr()
assert "Job finished successfully" in out
# Wrapper function for client library function
submit_pyspark_job_to_driver_node_group_cluster.submit_job(
PROJECT_ID, REGION, CLUSTER_NAME
)

# cluster deleted in teardown()
out, _ = capsys.readouterr()
assert "Job finished successfully" in out
finally:
teardown()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All we're doing is adding:

    finally:
        teardown()

Comment thread
NimJay marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,28 @@ def teardown():
max_tries=5,
)
def test_workflows(capsys):
# Setup driver node group cluster. TODO: cleanup b/424371877
command = f"""gcloud dataproc clusters create {CLUSTER_NAME} \
--region {REGION} \
--project {PROJECT_ID} \
--driver-pool-size=1 \
--driver-pool-id=pytest"""

output = subprocess.run(
command,
capture_output=True,
shell=True,
check=True,
)
print(output)
try:
# Setup driver node group cluster. TODO: cleanup b/424371877
command = f"""gcloud dataproc clusters create {CLUSTER_NAME} \
--region {REGION} \
--project {PROJECT_ID} \
--driver-pool-size=1 \
--driver-pool-id=pytest"""

# Wrapper function for client library function
submit_spark_job_to_driver_node_group_cluster.submit_job(
PROJECT_ID, REGION, CLUSTER_NAME
)
output = subprocess.run(
command,
capture_output=True,
shell=True,
check=True,
)
print(output)

out, _ = capsys.readouterr()
assert "Job finished successfully" in out
# Wrapper function for client library function
submit_spark_job_to_driver_node_group_cluster.submit_job(
PROJECT_ID, REGION, CLUSTER_NAME
)

# cluster deleted in teardown()
out, _ = capsys.readouterr()
assert "Job finished successfully" in out
finally:
teardown()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All we're doing is adding:

    finally:
        teardown()

Comment thread
NimJay marked this conversation as resolved.
Resolved
Loading