Skip to content

Commit

Permalink
renames started/finished keys
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Dec 2, 2021
1 parent ba21583 commit 1c6d357
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ 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['dbt_internal__started_at'] = datetime.utcnow().isoformat()
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 Down Expand Up @@ -370,7 +370,7 @@ def run_hooks(self, adapter, hook_type: RunHookType, extra_context):
fetch=False)

self.ran_hooks.append(hook)
hook._event_status['dbt_internal__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
fire_event(
Expand All @@ -386,8 +386,8 @@ def run_hooks(self, adapter, hook_type: RunHookType, extra_context):
)
# `_event_status` dict is only used for logging. Make sure
# it gets deleted when we're done with it
del hook._event_status["dbt_internal__started_at"]
del hook._event_status["dbt_internal__finished_at"]
del hook._event_status["started_at"]
del hook._event_status["finished_at"]
del hook._event_status["node_status"]

self._total_executed += len(ordered_hooks)
Expand Down
9 changes: 4 additions & 5 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,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['dbt_internal__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 @@ -224,8 +224,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['dbt_internal__finished_at'] = \
datetime.utcnow().isoformat()
runner.node._event_status['finished_at'] = datetime.utcnow().isoformat()
finally:
finishctx = TimestampNamed('finished_at')
with finishctx, DbtModelState(status):
Expand All @@ -238,8 +237,8 @@ def call_runner(self, runner):
)
# `_event_status` dict is only used for logging. Make sure
# it gets deleted when we're done with it
del runner.node._event_status["dbt_internal__started_at"]
del runner.node._event_status["dbt_internal__finished_at"]
del runner.node._event_status["started_at"]
del runner.node._event_status["finished_at"]
del runner.node._event_status["node_status"]

fail_fast = flags.FAIL_FAST
Expand Down

0 comments on commit 1c6d357

Please sign in to comment.