-
Notifications
You must be signed in to change notification settings - Fork 87
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
Infer values from child notebook loaded via dbutils.notebook.run() call #2083
Infer values from child notebook loaded via dbutils.notebook.run() call #2083
Conversation
# Conflicts: # src/databricks/labs/ucx/source_code/linters/context.py
…rom-child-notebook-in-run-cell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-process a collection of cells into a single tree and revert any refactoring that makes this PR hard to review.
@property | ||
def is_append(self): | ||
return self._is_append | ||
def mutate_path_lookup(self, path_lookup: PathLookup): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def mutate_path_lookup(self, path_lookup: PathLookup): | |
def apply_to(self, path_lookup: PathLookup): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -192,191 +198,29 @@ def _get_attribute_value(cls, node: Attribute): | |||
logger.debug(f"Missing handler for {name}") | |||
return None | |||
|
|||
def infer_values(self, state: CurrentSessionState | None = None) -> Iterable[InferredValue]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is a bit more difficult to review, as methods are moved, the reasoning is not clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code is moved to work around cyclic imports
@@ -0,0 +1,221 @@ | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't mix refactoring and new features in the same PR. it's completely unclear to me what changed in these changes and what's the new code. please revert the introduction of this module in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was moved from python_ast to work around cyclic imports
…notebook-run-call # Conflicts: # src/databricks/labs/ucx/source_code/base.py # src/databricks/labs/ucx/source_code/known.json # src/databricks/labs/ucx/source_code/linters/imports.py # src/databricks/labs/ucx/source_code/linters/python_ast.py # src/databricks/labs/ucx/source_code/notebooks/sources.py # tests/unit/source_code/linters/test_python_ast.py # tests/unit/source_code/test_notebook_linter.py
…notebook-run-call # Conflicts: # src/databricks/labs/ucx/source_code/base.py # src/databricks/labs/ucx/source_code/jobs.py # src/databricks/labs/ucx/source_code/known.py # src/databricks/labs/ucx/source_code/linters/files.py # src/databricks/labs/ucx/source_code/notebooks/cells.py # src/databricks/labs/ucx/source_code/notebooks/sources.py # tests/unit/source_code/notebooks/test_sources.py # tests/unit/source_code/test_functional.py # tests/unit/source_code/test_notebook_linter.py
✅ 160/160 passed, 1 flaky, 6 skipped, 3h39m15s total Flaky tests:
Running from acceptance #4548 |
…notebook-run-call
…notebook-run-call
…notebook-run-call
@nfx is something still blocking this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please verify in the real workspace
yield from self._mutate_path_lookup(base_node) | ||
return | ||
if isinstance(base_node, NotebookRunCall): | ||
has_unresolved, paths = base_node.get_notebook_paths(self._session_state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you 100% sure this behavior is necessary? dbutils.notebook.run() does not propagate variables to the parent notebook, only %run
does. provide a screenshot from a real workspace environment to confirm this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, that was an incorrect assumption
# Databricks notebook source | ||
|
||
dbutils.notebook.run("./values_across_notebooks_child.py") | ||
spark.table(f"{a}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this is the right logic? my hunch it does not compute on workspace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
closing in favor of #2091 |
Pull request was closed
Changes
When linting notebooks, use AST from child notebooks loaded via
dbutils.notebook.run()
to infer valuesLinked issues
Progresses #1205
Progresses #1901
Functionality
None
Tests
marginally improves not computed (-9/744) when running
make solacc