Skip to content

Commit

Permalink
print correct run time (include hooks) (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcarthur authored Jan 2, 2018
1 parent 598aeeb commit 4415cb6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## dbt 0.9.1 (unreleased)

### Bugfixes

- Include hook run time in reported model run time ([#607](https://github.com/fishtown-analytics/dbt/pull/607))

## dbt 0.9.0 (October 25, 2017)

This release focuses on improvements to macros, materializations, and package management. Check out [the blog post](https://blog.fishtownanalytics.com/whats-new-in-dbt-0-9-0-dd36f3572ac6) to learn more about what's possible in this new version of dbt.
Expand Down
15 changes: 13 additions & 2 deletions dbt/node_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,20 @@ def get_model_schemas(cls, flat_graph):

return schemas

@classmethod
def before_hooks(self, project, adapter, flat_graph):
pass

@classmethod
def before_run(self, project, adapter, flat_graph):
pass

@classmethod
def after_run(self, project, adapter, results, flat_graph, elapsed):
def after_run(self, project, adapter, results, flat_graph):
pass

@classmethod
def after_hooks(self, project, adapter, results, flat_graph, elapsed):
pass


Expand Down Expand Up @@ -352,8 +360,11 @@ def print_results_line(cls, results, execution_time):
.format(stat_line=stat_line, execution=execution))

@classmethod
def after_run(cls, project, adapter, results, flat_graph, elapsed):
def after_run(cls, project, adapter, results, flat_graph):
cls.safe_run_hooks(project, adapter, flat_graph, RunHookType.End)

@classmethod
def after_hooks(cls, project, adapter, results, flat_graph, elapsed):
cls.print_results_line(results, elapsed)

def describe_node(self):
Expand Down
6 changes: 4 additions & 2 deletions dbt/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,13 @@ def run_from_graph(self, Selector, Runner, query):
logger.info("")

try:
Runner.before_run(self.project, adapter, flat_graph)
Runner.before_hooks(self.project, adapter, flat_graph)
started = time.time()
Runner.before_run(self.project, adapter, flat_graph)
res = self.execute_nodes(linker, Runner, flat_graph, dep_list)
Runner.after_run(self.project, adapter, res, flat_graph)
elapsed = time.time() - started
Runner.after_run(self.project, adapter, res, flat_graph, elapsed)
Runner.after_hooks(self.project, adapter, res, flat_graph, elapsed)

finally:
adapter.cleanup_connections()
Expand Down

0 comments on commit 4415cb6

Please sign in to comment.