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

SNOWVATION: Replace parameter boilerplate with utility classes. #2751

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-jrose
Copy link
Contributor

@sfc-gh-jrose sfc-gh-jrose commented Dec 11, 2024

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-NNNNNNN

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
  3. Please describe how your code solves the related issue.

The goal of this refactor is to provide a central location for defining parameters and other snowpark-python configuration. This should make it easier to add additional parameters in the future as well as gate more deprecated or exerimental logic behind parameters.

Session parmeters are now all added in Session._initialize_config. All definition needed for them should happen there.
Package level confuguration settings should similarly all be defined in src/snowflake/snowpark/_internal/config.py

Parameters and package level configs can all be accessed via session.conf.

As part of this change I've moved all of the session level parameters over to the new settings style, but there are likely package level configuration options that I have missed. For now the parameters that are exposed as properties of the session object remain available in this manner, but in the future we should standardize the access method to be through the config object.

@sfc-gh-jrose sfc-gh-jrose added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Dec 11, 2024
@sfc-gh-jrose sfc-gh-jrose force-pushed the jrose_snow_vation_config_refactor branch from 72c910b to 0f2d9d2 Compare December 12, 2024 19:40
@sfc-gh-jrose sfc-gh-jrose marked this pull request as ready for review December 14, 2024 00:02
@sfc-gh-jrose sfc-gh-jrose requested review from a team as code owners December 14, 2024 00:02
Comment on lines -763 to +820
def conf(self) -> RuntimeConfig:
def conf(self) -> SettingStore:
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines -638 to 620
],
"parameter_name", ["auto_clean_up_temp_table_enabled", "cte_optimization_enabled"]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

merge artifact

Comment on lines +256 to +259
session.auto_clean_up_temp_table_enabled = True
assert session.auto_clean_up_temp_table_enabled is True
assert "auto_clean_up_temp_table_enabled is experimental" in caplog.text
session.auto_clean_up_temp_table_enabled = False
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not raise warning only when we enable the param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The warning is only raised when setting to a non-default value.

"""

name: str
description: str | None = field(default=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: str | None = field(default=None)
description: Optional[str] = field(default=None)

nit: we follow this style in the repo.

@sfc-gh-aalam
Copy link
Contributor

would it be easy to cover changes made in this PR: #2673

@sfc-gh-jrose
Copy link
Contributor Author

would it be easy to cover changes made in this PR: #2673

That wouldn't be too hard. I think I'd recommend downgrading from an error to a warning though so that users can be aware that they should clean things up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md snowpark-pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants