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 3 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
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 @@ -345,8 +353,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