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

Fix cancelled ephemeral models (#1993) #2024

Merged
merged 1 commit into from
Jan 6, 2020
Merged
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
5 changes: 5 additions & 0 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ def execute_nodes(self):
raise

for conn_name in adapter.cancel_open_connections():
if self.manifest is not None:
node = self.manifest.nodes.get(conn_name)
if node is not None and node.is_ephemeral_model:
Copy link
Contributor

@drewbanin drewbanin Jan 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any node types that won't have an is_ephemeral_model attribute? Like tests/snapshots/run-operations, etc?

Edit: I don't think run-operations go through this code-path in practice, right?

Copy link
Contributor Author

@beckjake beckjake Jan 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run-operations can't go through this path. Snapshots have is_ephemeral_model, this code path can only happen for nodes (in particular manifest.nodes.get(conn_name) can only return an Optional[CompileResultNode]) mypy will actually complain if is_ephemeral_model is missing from any type that can end up in node, I'm pretty sure!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing, ship it :)

continue
# if we don't have a manifest/don't have a node, print anyway.
dbt.ui.printer.print_cancel_line(conn_name)

pool.join()
Expand Down