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

log statements in google dataproc #41812

Closed
Changes from 2 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
9 changes: 9 additions & 0 deletions airflow/providers/google/cloud/hooks/dataproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,8 @@ def create_batch(
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

From my point of view, all these messages should be displayed on the operators level, so maybe we can move them from hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@VladaZakharova other logs are already present at operator level so just added one more.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be in the hook level because some other operators can use the same hook and better the log be in one place (hook) instead of each operator.

client = self.get_batch_client(region)
parent = f"projects/{project_id}/regions/{region}"

self.log.debug(f"Creating batch: {batch}")

result = client.create_batch(
request={
Expand Down Expand Up @@ -1034,6 +1036,8 @@ def delete_batch(
"""
client = self.get_batch_client(region)
name = f"projects/{project_id}/locations/{region}/batches/{batch_id}"

self.log.debug(f"Deleting batch with batch id: {batch_id}")

gagan-bhullar-tech marked this conversation as resolved.
Show resolved Hide resolved
client.delete_batch(
request={
Expand Down Expand Up @@ -1069,6 +1073,8 @@ def get_batch(
"""
client = self.get_batch_client(region)
name = f"projects/{project_id}/locations/{region}/batches/{batch_id}"

self.log.debug(f"Getting batch with batch id: {batch_id}")

result = client.get_batch(
request={
Expand Down Expand Up @@ -1851,6 +1857,7 @@ async def create_batch(
"""
client = self.get_batch_client(region)
parent = f"projects/{project_id}/regions/{region}"
self.log.debug(f"Creating batch: {batch}")

result = await client.create_batch(
request={
Expand Down Expand Up @@ -1890,6 +1897,7 @@ async def delete_batch(
"""
client = self.get_batch_client(region)
name = f"projects/{project_id}/locations/{region}/batches/{batch_id}"
self.log.debug(f"Deleting batch with batch id: {batch_id}")

await client.delete_batch(
request={
Expand Down Expand Up @@ -1925,6 +1933,7 @@ async def get_batch(
"""
client = self.get_batch_client(region)
name = f"projects/{project_id}/locations/{region}/batches/{batch_id}"
self.log.debug(f"Getting batch with batch id: {batch_id}")

result = await client.get_batch(
request={
Expand Down