Skip to content

Commit

Permalink
add node type codes to more events + more hook log data (#4378)
Browse files Browse the repository at this point in the history
* add node type codes to more events + more hook log

* minor fixes

* renames started/finished keys

* made process more clear

* fixed errors

* Put back report_node_data in fresshness.py

Co-authored-by: Gerda Shank <gerda@dbtlabs.com>

automatic commit by git-black, original commits:
  b3039fd
  • Loading branch information
emmyoop authored and iknox-fa committed Feb 8, 2022
1 parent 0d834a5 commit 82ac0c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ def run_hooks(self, adapter, hook_type: RunHookType, extra_context):
finishctx = TimestampNamed("node_finished_at")

for idx, hook in enumerate(ordered_hooks, start=1):
hook._event_status['started_at'] = datetime.utcnow().isoformat()
hook._event_status['node_status'] = RunningStatus.Started
hook._event_status["started_at"] = datetime.utcnow().isoformat()
hook._event_status["node_status"] = RunningStatus.Started
sql = self.get_hook_sql(adapter, hook, idx, num_hooks,
extra_context)

Expand All @@ -357,12 +357,12 @@ def run_hooks(self, adapter, hook_type: RunHookType, extra_context):
response, _ = adapter.execute(sql, auto_begin=False, fetch=False)
status = response._message
else:
status = 'OK'
status = "OK"

self.ran_hooks.append(hook)
hook._event_status['finished_at'] = datetime.utcnow().isoformat()
hook._event_status["finished_at"] = datetime.utcnow().isoformat()
with finishctx, DbtModelState({'node_status': 'passed'}):
hook._event_status['node_status'] = RunStatus.Success
hook._event_status["node_status"] = RunStatus.Success
fire_event(
PrintHookEndLine(
statement=hook_text,
Expand Down
4 changes: 2 additions & 2 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def call_runner(self, runner):
with RUNNING_STATE, uid_context:
startctx = TimestampNamed("node_started_at")
index = self.index_offset(runner.node_index)
runner.node._event_status['started_at'] = datetime.utcnow().isoformat()
runner.node._event_status["started_at"] = datetime.utcnow().isoformat()
runner.node._event_status["node_status"] = RunningStatus.Started
extended_metadata = ModelMetadata(runner.node, index)

Expand All @@ -226,7 +226,7 @@ def call_runner(self, runner):
result = runner.run_with_hooks(self.manifest)
status = runner.get_result_status(result)
runner.node._event_status["node_status"] = result.status
runner.node._event_status['finished_at'] = datetime.utcnow().isoformat()
runner.node._event_status["finished_at"] = datetime.utcnow().isoformat()
finally:
finishctx = TimestampNamed("finished_at")
with finishctx, DbtModelState(status):
Expand Down

0 comments on commit 82ac0c3

Please sign in to comment.