Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print correct run time (include hooks) #607

Merged
merged 5 commits into from
Jan 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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