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

Updates to warehouse-per-model logging and tests #511

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

rcypher-databricks
Copy link
Collaborator

Description

  • Updated the debug logging for warehouse-per-model to include thread id and relation name.
  • Updated the warehouse-per-model functional tests to include a seed and a snapshot that specify an alternate compute. Changed the test conditions to include checking log output for messages that indicate the alternate compute was used.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

Updated the debug logging for warehouse-per-model to include thread id and relation name.
Updated the warehouse-per-model functional test to include a seed and a snapshot that specify an alternate compute.  Changed the test conditions to include checking log output for messages that indicate the alternate compute was used.

Signed-off-by: Raymond Cypher <[email protected]>
@@ -1120,21 +1121,31 @@ def _get_compute_name(node: Optional[ResultNode]) -> Optional[str]:


def _get_http_path(node: Optional[ResultNode], creds: DatabricksCredentials) -> Optional[str]:
thread_id = (os.getpid(), get_ident())
# Get the http path of the compute resource specified in the node's config.
# If none is specified return the default path from creds.
compute_name = _get_compute_name(node)
if not node or not compute_name:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This structure has become a little weird. I believe we can drop the if not node.

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can't due to the creds.http_path. Still, worth thinking about restructuring because its so odd to check if something is not, and then immediately check if it is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Given this weirdness, let's add either a unit test or an end to end test that validates we do the expected thing in the default compute case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that if not node or not compute_name: is an odd structure. However I originally did it that way because using just if not compute_name: produced linting errors. I'll re-organize things.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the existing unit tests cover all the possibilities for what can be passed in to _get_http_path

Copy link
Collaborator

@benc-db benc-db left a comment

Choose a reason for hiding this comment

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

Please add a test validating that we use the default case as expected when in an env where we have some models with specified compute and some without.

Updated functional tests to add a model using the default compute alongside models using alternate compute.
Updated the error message for when a named compute does not exist or does not specify http_path.
Clarified the logic in _get_http_path()
Signed-off-by: Raymond Cypher <[email protected]>
@rcypher-databricks rcypher-databricks merged commit ceae0e4 into databricks:main Nov 20, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants