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