Skip to content

Commit

Permalink
Add more logs to troubleshoot custom selector (astronomer#809)
Browse files Browse the repository at this point in the history
A user (ZD case: 38982) reported being unable to see the test node for
one specific model in a particular DAG when using
RenderConfig(select=tags). They were using the custom Cosmos selector.
It seems the selector worked as expected for other models and for the
same model/test in a different DAG.

This CR adds more logs for troubleshooting when using.
  • Loading branch information
tatiana authored and arojasb3 committed Jul 14, 2024
1 parent 76e5a13 commit 31db738
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cosmos/dbt/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,23 @@ def select_nodes_ids_by_intersection(self) -> set[str]:

def _should_include_node(self, node_id: str, node: DbtNode) -> bool:
"Checks if a single node should be included. Only runs once per node with caching."
logger.debug("Inspecting if the node <%s> should be included.", node_id)
if node_id in self.visited_nodes:
return node_id in self.selected_nodes

self.visited_nodes.add(node_id)

if node.resource_type == DbtResourceType.TEST:
node.tags = getattr(self.nodes.get(node.depends_on[0]), "tags", [])
logger.debug(
"The test node <%s> inherited these tags from the parent node <%s>: %s",
node_id,
node.depends_on[0],
node.tags,
)

if not self._is_tags_subset(node):
logger.debug("Excluding node <%s>", node_id)
return False

node_config = {key: value for key, value in node.config.items() if key in SUPPORTED_CONFIG}
Expand Down

0 comments on commit 31db738

Please sign in to comment.