Skip to content

Commit

Permalink
Use tempfile.mkdtemp to create a temporary directory for local data p…
Browse files Browse the repository at this point in the history
…ersistence.

Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario committed Mar 18, 2022
1 parent 843cda9 commit 861b157
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions flytekit/core/data_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"""

import datetime
import os
import pathlib
import re
import tempfile
import typing
from abc import abstractmethod
from distutils import dir_util
Expand Down Expand Up @@ -448,11 +448,9 @@ def put_data(self, local_path: Union[str, os.PathLike], remote_path: str, is_mul
DataPersistencePlugins.register_plugin("file://", DiskPersistence)
DataPersistencePlugins.register_plugin("/", DiskPersistence)

tmp_dir_prefix = f"{os.sep}tmp{os.sep}flyte"

tmp_dir = os.path.join(tmp_dir_prefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
tmp_dir_prefix = tempfile.mkdtemp(prefix="tmp-flyte")
default_local_file_access_provider = FileAccessProvider(
local_sandbox_dir=os.path.join(tmp_dir, "sandbox"),
raw_output_prefix=os.path.join(tmp_dir, "raw"),
local_sandbox_dir=os.path.join(tmp_dir_prefix, "sandbox"),
raw_output_prefix=os.path.join(tmp_dir_prefix, "raw"),
data_config=DataConfig.auto(),
)

0 comments on commit 861b157

Please sign in to comment.