Skip to content

Commit b145811

Browse files
committed
use the correct file path
1 parent bbc7904 commit b145811

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

functions-python/batch_process_dataset/src/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ def download_content(self, temporary_file_path):
133133
extracted_files_path = os.path.join(
134134
temporary_file_path.split(".")[0], "extracted"
135135
)
136+
# Create the directory for extracted files if it does not exist
137+
os.makedirs(extracted_files_path, exist_ok=True)
136138
with zipfile.ZipFile(temporary_file_path, "r") as zip_ref:
137-
zip_ref.extractall(os.path.dirname(extracted_files_path))
139+
zip_ref.extractall(path=extracted_files_path)
138140
# List all files in the extracted directory
139-
extracted_files = os.listdir(os.path.dirname(extracted_files_path))
141+
extracted_files = os.listdir(extracted_files_path)
140142
self.logger.info(f"Extracted files: {extracted_files}")
141143
return file_hash, is_zip, extracted_files_path
142144

functions-python/helpers/logger.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def get_logger(name: str, stable_id: str = None):
7373
If stable_id is provided, the StableIdFilter is added.
7474
This method can be called multiple times for the same logger name without creating a side effect.
7575
"""
76-
logger = logging.getLogger(name)
76+
# Create the logger with the provided name to avoid retuning the same logger instance
77+
logger = (
78+
logging.getLogger(name)
79+
if not stable_id
80+
else logging.getLogger(f"{name}_{stable_id}")
81+
)
7782
if stable_id and not any(
7883
isinstance(log_filter, StableIdFilter) for log_filter in logger.filters
7984
):

0 commit comments

Comments
 (0)