fix: pass arguments to Python via sys.argv instead of heredoc interpolation

- Use `python3 <<HEREDOC - "$arg1" "$arg2"` pattern
- Avoids bash variable substitution issues in heredoc
- Fixes hanging issue where parse_yaml was silently failing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 16:07:54 +01:00
parent a52c5979a3
commit 02b7bedafb

View File

@@ -191,23 +191,26 @@ parse_yaml() {
local yaml_file="$1"
local category="$2"
python3 - <<EOPYAML
python3 <<EOPYAML - "$yaml_file" "$category"
import yaml
import sys
yaml_file = sys.argv[1]
category = sys.argv[2]
try:
with open('${yaml_file}', 'r') as f:
with open(yaml_file, 'r') as f:
config = yaml.safe_load(f)
if '${category}' == 'settings':
if category == 'settings':
settings = config.get('settings', {})
print(f"CACHE_DIR={settings.get('cache_dir', '/workspace/huggingface_cache')}")
print(f"PARALLEL_DOWNLOADS={settings.get('parallel_downloads', 1)}")
elif '${category}' == 'categories':
elif category == 'categories':
for cat_name in config.get('model_categories', {}).keys():
print(cat_name)
elif '${category}' in config.get('model_categories', {}):
models = config['model_categories']['${category}']
elif category in config.get('model_categories', {}):
models = config['model_categories'][category]
for model in models:
repo_id = model.get('repo_id', '')
description = model.get('description', '')