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

--fail-fast with BigQuery does not show original error message #2644

Closed
1 of 5 tasks
joshpeng-quibi opened this issue Jul 23, 2020 · 3 comments · Fixed by #2646
Closed
1 of 5 tasks

--fail-fast with BigQuery does not show original error message #2644

joshpeng-quibi opened this issue Jul 23, 2020 · 3 comments · Fixed by #2646
Labels
bigquery bug Something isn't working good_first_issue Straightforward + self-contained changes, good for new contributors!
Milestone

Comments

@joshpeng-quibi
Copy link
Contributor

joshpeng-quibi commented Jul 23, 2020

Describe the bug

When using dbt run --fail-fast on BQ, the original passthrough error message is not present in the output logs.

dbt run -m +some_model --fail-fast
Running with dbt=0.17.0
Found 176 models, 1261 tests, 0 snapshots, 2 analyses, 364 macros, 0 operations, 0 seed files, 27 sources

16:32:26 | Concurrency: 8 threads (target='dev')
16:32:26 | 
16:32:26 | 1 of 4 START table model someschema.some_model........ [RUN]
16:32:27 | 1 of 4 ERROR creating table model someschema.some_model [ERROR in 1.02s]
16:32:27 | The bigquery adapter does not support query cancellation. Some queries may still be running!
Encountered an error:
FailFast Error in model some_model (models/someschema/some_model.sql)
  Failing early due to test failure or runtime error

Steps To Reproduce

  1. Setup a broken model in dbt against a BigQuery connection
  2. Run with dbt run --fail-fast
  3. Look at output log

Expected behavior

We should still see the original passthrough error message prior to the FailFast Error in... messaging like how it does in other connection types.

This is output from another connection type where we can see the Database Error in... messaging present:

dbt run --fail-fast
Running with dbt=0.17.1
Found 1 model, 0 tests, 0 snapshots, 0 analyses, 134 macros, 0 operations, 2 seed files, 1 source
19:00:22 | Concurrency: 1 threads (target='dev')
19:00:22 |
19:00:22 | 1 of 1 START view model dbt_jcohen.bad_model......................... [RUN]
19:00:22 | 1 of 1 ERROR creating view model dbt_jcohen.bad_model................ [ERROR in 0.08s]
19:00:23 | CANCEL query model.random.bad_model.................................. [CANCEL]
Database Error in model bad_model (models/bad_model.sql)
  column "askdfhdlrgioj" does not exist
  LINE 4:     select askdfhdlrgioj
                     ^
  compiled SQL at target/run/random/models/bad_model.sql
Encountered an error:
FailFast Error in model bad_model (models/bad_model.sql)
  Failing early due to test failure or runtime error

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

installed version: 0.17.0
   latest version: 0.17.1

Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Plugins:
  - bigquery: 0.17.0
  - snowflake: 0.17.0
  - redshift: 0.17.0
  - postgres: 0.17.0

The operating system you're using:
macOS 10.14.6

The output of python --version:
Python 3.7.4

@joshpeng-quibi joshpeng-quibi added bug Something isn't working triage labels Jul 23, 2020
@clausherther
Copy link
Contributor

👍
Would be really great to be able to use --fail-fast in production to cut down on BQ cost, while still getting full error messages to route to the right person.

@jtcohen6
Copy link
Contributor

Thanks for opening this, @joshpeng-quibi!

The operative lines are here: https://github.com/fishtown-analytics/dbt/blob/88e26da026eddd0c94b2bf591cf2194995c157f7/core/dbt/task/runnable.py#L181-L188

I stepped through this locally and confirmed that result.error does contain the appropriate database error. It just fails to eventually print out. I wonder if this is due to an odd logging interaction between _raise_next_tick and _cancel_connections, namely the adapter.is_cancelable() classmethod that causes the BigQuery adapter to print out:

The bigquery adapter does not support query cancellation. Some queries may still be running!

The code is tricky in places, but I believe the scope to be quite limited, so I'm tagging with "good first issue" to see if there are any community members interested in working on a fix.

@jtcohen6 jtcohen6 added good_first_issue Straightforward + self-contained changes, good for new contributors! bigquery and removed triage labels Jul 24, 2020
@jtcohen6 jtcohen6 added this to the 0.17.2 milestone Jul 24, 2020
@jtcohen6 jtcohen6 linked a pull request Jul 24, 2020 that will close this issue
4 tasks
@jtcohen6
Copy link
Contributor

Resolved by #2646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bigquery bug Something isn't working good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants