Skip to content

Commit

Permalink
SNOW-1418523: Remove session param that can be local
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-aalam committed Sep 11, 2024
1 parent fe51d4d commit bc54e49
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/snowflake/snowpark/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ def __init__(
)
self._custom_package_usage_config: Dict = {}
self._conf = self.RuntimeConfig(self, options or {})
self._tmpdir_handler: Optional[tempfile.TemporaryDirectory] = None
self._runtime_version_from_requirement: str = None
self._temp_table_auto_cleaner: TempTableAutoCleaner = TempTableAutoCleaner(self)
if self._auto_clean_up_temp_table_enabled:
Expand Down Expand Up @@ -1651,8 +1650,8 @@ def _upload_unsupported_packages(

try:
# Setup a temporary directory and target folder where pip install will take place.
self._tmpdir_handler = tempfile.TemporaryDirectory()
tmpdir = self._tmpdir_handler.name
tmpdir_handler = tempfile.TemporaryDirectory()
tmpdir = tmpdir_handler.name
target = os.path.join(tmpdir, "unsupported_packages")
if not os.path.exists(target):
os.makedirs(target)
Expand Down Expand Up @@ -1737,9 +1736,7 @@ def _upload_unsupported_packages(
for requirement in supported_dependencies + new_dependencies
]
)
metadata_local_path = os.path.join(
self._tmpdir_handler.name, metadata_file
)
metadata_local_path = os.path.join(tmpdir_handler.name, metadata_file)
with open(metadata_local_path, "w") as file:
for key, value in metadata.items():
file.write(f"{key},{value}\n")
Expand Down Expand Up @@ -1775,9 +1772,9 @@ def _upload_unsupported_packages(
f"-third-party-packages-from-anaconda-in-a-udf."
)
finally:
if self._tmpdir_handler:
self._tmpdir_handler.cleanup()
self._tmpdir_handler = None
if tmpdir_handler:
tmpdir_handler.cleanup()
tmpdir_handler = None

return supported_dependencies + new_dependencies

Expand Down

0 comments on commit bc54e49

Please sign in to comment.