Comments (4)
Thanks for reporting this @mbarugelCA π
I was able to reproduce the same thing that you reported.
Reprex
First, I needed to make sure I had all the relevant environment variables unset:
echo $DBT_SEND_ANONYMOUS_USAGE_STATS
echo $DO_NOT_TRACK
unset DBT_SEND_ANONYMOUS_USAGE_STATS
unset DO_NOT_TRACK
From there, I ran all the following commands to see what dbt is doing:
dbt --debug ls -s something --send-anonymous-usage-stats | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
DBT_SEND_ANONYMOUS_USAGE_STATS=true dbt --debug ls -s something | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
dbt --debug ls -s something --no-send-anonymous-usage-stats | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
DBT_SEND_ANONYMOUS_USAGE_STATS=false dbt --debug ls -s something | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
DO_NOT_TRACK=true dbt --debug ls -s something | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
Explanation:
--debug
writes debug-level logs to standard out (rather than needing to look inlogs/dbt.log
.- Then the
grep -Eo "'send_anonymous_usage_stats': '(.*)'"
part finds the log line that shows the config settings that dbt is using.
The output we'd expect is:
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
But depending on the config setting for send_anonymous_usage_stats
within profiles.yml
, I saw different behavior.
When send_anonymous_usage_stats
is either set to True
(default), None
, or not set within profiles.yml
:
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'True' β
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
When send_anonymous_usage_stats
is set to False
within profiles.yml
:
'send_anonymous_usage_stats': 'False' β
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
Conclusion
π So it looks like the --send-anonymous-usage-stats / --no-send-anonymous-usage-stats
CLI flags are being ignored rather than adhering to the standard precedence.
Acceptance criteria
The output from the above commands is always the following, regardless if the send_anonymous_usage_stats
setting within profiles.yml
is None
, True
, or False
):
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'True'
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
'send_anonymous_usage_stats': 'False'
from dbt-core.
Should we raise another issue that if the client is not connected to the internet we should not hang for 30 secs?
It seems reasonable to give the anonymous tracking a quick shot and give up after a very short amount of time (1 or 2 seconds total) if it isn't able to establish a connection.
If you want to open an issue for this, I'll label it as help wanted
.
from dbt-core.
I'm not sure if it affects the behavior described in this issue or not, but we take an additional environment variable DO_NOT_TRACK
into consideration here:
dbt-core/core/dbt/cli/flags.py
Lines 281 to 283 in 68970d0
We mostly expose only a single environment variable to control flags / global configs, but this is the rare case (and maybe only one) in which we allow two different environment variable names:
DBT_SEND_ANONYMOUS_USAGE_STATS
DO_NOT_TRACK
According to the click
docs here, envvar
can also be:
a list of different environment variables where the first one is picked.
Also, click
handles the BOOL
parameter type like this:
The string values β1β, βtrueβ, βtβ, βyesβ, βyβ, and βonβ convert to
True
. β0β, βfalseβ, βfβ, βnoβ, βnβ, and βoffβ convert toFalse
.
This happens to be exactly what is in the logic below, which would lower the barriers to that portion of the code refactor:
dbt-core/core/dbt/cli/flags.py
Line 282 in 68970d0
So we might be able to remove this code in favor of adding this here:
envvar=["DO_NOT_TRACK", "DBT_SEND_ANONYMOUS_USAGE_STATS"],
At the very least, it would reduce the number of occurrences of os.getenv
in the code base (which feels like tech debt). But there's a possibility it would also resolve the undesirable behavior described in this issue.
from dbt-core.
I just found out this same issue!
I was running dbt-duckdb
on a place (no Internet), and saw that any run was hanging for 30s.
I suspected it was due to tracking so I tried adding --no-send-anonymous-usage-stats
, but it was still hanging.
Now trying with no internet and DO_NOT_TRACK=1
, it doesn't hang.
This seems related to this value:
Line 59 in afb2d61
Should we raise another issue that if the client is not connected to the internet we should not hang for 30 secs?
from dbt-core.
Related Issues (20)
- Add `--host` flag to `dbt docs serve`, defaulting to '127.0.0.1' HOT 2
- [Bug] `dbt -v` doesn't know that adapters are decoupled from core HOT 1
- Warn if `updated_at` field for snapshot is not same datatype (or timezone) as what's returned in `snapshot_get_time()` HOT 2
- Improve capturing the history of records in a deleted state HOT 2
- New snapshot config to validate uniqueness before merge
- Support specifying types for recording
- [Bug] the run_query macro causes unit tests to fail with a SQL Compilation error HOT 1
- [Feature] No more jinja block for snapshots - new snapshot design
- [Feature] Emit a more specific error when there are duplicate columns in a model with an enforced contract HOT 1
- Replace jsonschema with fastjsonschema for validation
- [Security] CVE-2019-8341 advice please HOT 5
- [Feature] Conservative with changing public Python API's HOT 1
- [Feature] Unit tests should support Gherkin table style inputs
- [Bug] Error running unit tests that use the `dbt_utils.star` macro HOT 2
- Create "happy path" project fixture and use it for `tests/functional/list/test_list.py`
- Use, and extend as necessary, happy path fixture for `tests/functional/show/test_show.py`
- [Bug] dbt test --select "source:*" runs model tests if they reference a source HOT 3
- [Feature] Add a head command to see the first rows of a table HOT 5
- [Feature] Add `--fail-if-nothing-selected` (or something similar) HOT 6
- [Bug] Not able to select unit tests via the `--resource-type` flag HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-core.