From 11509ba8c7b73877da93afdf4dc876bd0eb3fc69 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 31 Oct 2025 00:03:39 -0400 Subject: [PATCH] fix: merge script now writes to current directory for volume compatibility Changed merge_jsonl.py to use os.getcwd() instead of os.path.dirname(__file__) to ensure merged.jsonl is written to the working directory where data files exist, not to the script's installation directory. Root cause: - Dockerfile copies scripts to /app/scripts/ for volume compatibility - entrypoint.sh runs: cd /app/data && python /app/scripts/merge_jsonl.py - Old logic used script directory (/app/scripts/), ignoring working directory - This caused merged.jsonl to be created in /app/scripts/ instead of /app/data/ - Since /app/data/ is volume-mounted, merged file was not visible to host Solution: - Scripts now respect current working directory (Unix philosophy) - Works correctly with volume mounts and script relocation - Tested in both local and Docker directory structure scenarios Fixes the issue where merged.jsonl was missing from mounted data volume. --- data/merge_jsonl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/merge_jsonl.py b/data/merge_jsonl.py index db49b0f..a48bce7 100644 --- a/data/merge_jsonl.py +++ b/data/merge_jsonl.py @@ -18,7 +18,8 @@ all_nasdaq_100_symbols = [ ] # 合并所有以 daily_price 开头的 json,逐文件一行写入 merged.jsonl -current_dir = os.path.dirname(__file__) +# Use current working directory instead of script directory for volume compatibility +current_dir = os.getcwd() pattern = os.path.join(current_dir, 'daily_price*.json') files = sorted(glob.glob(pattern))