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

move job link logging just after the job submit #697

Merged
merged 3 commits into from
Jun 28, 2023
Merged
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
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20230505-184427.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Move the BQ Job link after the job submission instead of job done
time: 2023-05-05T18:44:27.939038+02:00
custom:
Author: Kayrnt
Issue: "696"
13 changes: 10 additions & 3 deletions dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,6 @@ def execute(
else:
message = f"{code}"

if location is not None and job_id is not None and project_id is not None:
logger.debug(self._bq_job_link(location, project_id, job_id))

response = BigQueryAdapterResponse( # type: ignore[call-arg]
_message=message,
rows_affected=num_rows,
Expand Down Expand Up @@ -663,6 +660,16 @@ def _query_and_results(
# Cannot reuse job_config if destination is set and ddl is used
job_config = google.cloud.bigquery.QueryJobConfig(**job_params)
query_job = client.query(query=sql, job_config=job_config, timeout=job_creation_timeout)

if (
query_job.location is not None
and query_job.job_id is not None
and query_job.project is not None
):
logger.debug(
Copy link

@rob-apella rob-apella Jun 1, 2023

Choose a reason for hiding this comment

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

hey @Kayrnt! what do you think about making this an info level log?

this job URL is super useful even beyond debugging code, since it's the ground truth of what logic and process is actually executing the model. I think it should be more readily available, understanding that most apps out there probably wouldn't enable debug logs in production

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @robsicurelli, I agree with you that it's making the logs unnecessarily verbose if you'd like to keep BQ links in your scheduler logs all the time.
I'm fine moving it to info but I'll let @Fleid call the shot on that one 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not against it, but that should be made into its own issue/PR rather than addressed here.
We need a visible comment section for people to complain, and an easy way to revert if there's unintended consequences ;)

Choose a reason for hiding this comment

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

@Fleid that sounds good to me. I'm happy to stamp this PR as-is, and open another issue for changing the log level

self._bq_job_link(query_job.location, query_job.project, query_job.job_id)
)

iterator = query_job.result(max_results=limit, timeout=job_execution_timeout)

return query_job, iterator
Expand Down