feat(cron): Load profile-specific config.yaml

Part of #334. When job has profile set, loads config.yaml from profiles/PROFILE/config.yaml.
This commit is contained in:
2026-04-14 01:25:49 +00:00
parent 4dcfa11593
commit de80911ab9

View File

@@ -720,10 +720,21 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]:
model = job.get("model") or os.getenv("HERMES_MODEL") or ""
# Load config.yaml for model, reasoning, prefill, toolsets, provider routing
# If profile is set, load profile-specific config
_cfg = {}
try:
import yaml
_cfg_path = str(_hermes_home / "config.yaml")
profile = job.get("profile")
if profile:
profile_cfg_path = _hermes_home / "profiles" / profile / "config.yaml"
if profile_cfg_path.exists():
_cfg_path = str(profile_cfg_path)
logger.info("Job '%s': Loading profile config from %s", job_id, _cfg_path)
else:
_cfg_path = str(_hermes_home / "config.yaml")
logger.debug("Job '%s': Profile config not found, using default: %s", job_id, _cfg_path)
else:
_cfg_path = str(_hermes_home / "config.yaml")
if os.path.exists(_cfg_path):
with open(_cfg_path) as _f:
_cfg = yaml.safe_load(_f) or {}