diff --git a/core/dbt/tracking.py b/core/dbt/tracking.py index 61d687985c5..c32cd17706d 100644 --- a/core/dbt/tracking.py +++ b/core/dbt/tracking.py @@ -248,7 +248,7 @@ def get_dbt_env_context(): def track(user, *args, **kwargs): - if user.do_not_track: + if user is None or user.do_not_track: return else: logger.debug("Sending event: {}".format(kwargs)) @@ -278,8 +278,6 @@ def track_invocation_start(config=None, args=None): def track_project_load(options): context = [SelfDescribingJson(LOAD_ALL_TIMING_SPEC, options)] - assert active_user is not None, \ - 'Cannot track project loading time when active user is None' track( active_user, @@ -292,8 +290,6 @@ def track_project_load(options): def track_resource_counts(resource_counts): context = [SelfDescribingJson(RESOURCE_COUNTS, resource_counts)] - assert active_user is not None, \ - 'Cannot track resource counts when active user is None' track( active_user, @@ -306,8 +302,6 @@ def track_resource_counts(resource_counts): def track_model_run(options): context = [SelfDescribingJson(RUN_MODEL_SPEC, options)] - assert active_user is not None, \ - 'Cannot track model runs when active user is None' track( active_user, @@ -320,8 +314,6 @@ def track_model_run(options): def track_rpc_request(options): context = [SelfDescribingJson(RPC_REQUEST_SPEC, options)] - assert active_user is not None, \ - 'Cannot track rpc requests when active user is None' track( active_user, @@ -333,9 +325,6 @@ def track_rpc_request(options): def track_package_install(config, args, options): - assert active_user is not None, \ - 'Cannot track package installs when active user is None' - invocation_data = get_invocation_context(active_user, config, args) context = [ @@ -354,10 +343,6 @@ def track_package_install(config, args, options): def track_deprecation_warn(options): - - assert active_user is not None, \ - 'Cannot track deprecation warnings when active user is None' - context = [ SelfDescribingJson(DEPRECATION_WARN_SPEC, options) ] @@ -382,9 +367,6 @@ def track_invocation_end( get_dbt_env_context() ] - assert active_user is not None, \ - 'Cannot track invocation end when active user is None' - track( active_user, category="dbt", @@ -397,9 +379,6 @@ def track_invocation_end( def track_invalid_invocation( config=None, args=None, result_type=None ): - assert active_user is not None, \ - 'Cannot track invalid invocations when active user is None' - user = active_user invocation_context = get_invocation_invalid_context( user, @@ -425,9 +404,6 @@ def track_invalid_invocation( def track_experimental_parser_sample(options): context = [SelfDescribingJson(EXPERIMENTAL_PARSER, options)] - assert active_user is not None, \ - 'Cannot track project loading time when active user is None' - track( active_user, category='dbt',