File size: 785 Bytes
f837c69
 
 
 
6005177
 
f837c69
 
 
 
 
2c834ce
f837c69
2c834ce
 
f837c69
 
 
2c834ce
 
9459739
f837c69
 
 
2c834ce
 
f837c69
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Module to create an output folder for saving results."""

import os
from datetime import datetime
from pathlib import Path

from ..telemetry import Logger

LOGGER = Logger.get_logger()


def create_output_folder(session_id: str) -> str:
    """Create a new folder where the output will be saved.
    Args:
        session_id (str): Unique identifier for the current session.
    Returns:
        str: Path to the newly created output folder.
    """

    base_path = Path.cwd() / "tmp" / session_id
    base_path.mkdir(parents=True, exist_ok=True)
    timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
    work_dir = os.path.join(base_path, timestamp)
    os.makedirs(work_dir, exist_ok=False)
    LOGGER.info("📁 Created new subfolder: %s", work_dir)

    return work_dir