Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed Feb 3, 2017
1 parent 810124b commit 05d4472
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions dbt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def run_from_args(parsed):

return result


def invoke_dbt(parsed):
task = None
proj = None
Expand Down
3 changes: 2 additions & 1 deletion dbt/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,9 @@ def on_complete(run_model_results):
run_model_result.execution_time
)

invocation_id = dbt.tracking.active_user.invocation_id
dbt.tracking.track_model_run({
"invocation_id": dbt.tracking.active_user.invocation_id,
"invocation_id": invocation_id,
"index": index,
"total": num_models,
"execution_time": run_model_result.execution_time,
Expand Down
15 changes: 12 additions & 3 deletions dbt/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

active_user = None


class User(object):

def __init__(self):
Expand Down Expand Up @@ -172,7 +173,6 @@ def get_dbt_env_context():
return SelfDescribingJson(INVOCATION_ENV_SPEC, data)



def track(user, *args, **kwargs):
if user.do_not_track:
return
Expand Down Expand Up @@ -237,8 +237,16 @@ def track_invalid_invocation(
):

user = active_user
invocation_context = get_invocation_invalid_context(
user,
project,
args,
result_type,
result
)

context = [
get_invocation_invalid_context(user, project, args, result_type, result),
invocation_context,
get_platform_context(),
get_dbt_env_context()
]
Expand All @@ -256,12 +264,13 @@ def flush():
logger.debug("Flushing usage events")
tracker.flush()


def do_not_track():
global active_user
active_user = User()


def initialize_tracking():
global active_user
active_user = User()
active_user.initialize()

0 comments on commit 05d4472

Please sign in to comment.