发布

  • [OPIK-3754] [BE] Add Optimization Studio config defaults (#4756)

    frostbyte_neo 发布于 2026-01-16 11:35:22 +00:00

    • [OPIK-3754] [BE] Add Optimization Studio config defaults for LLM max tokens and RQ failure TTL
    • Add OPTSTUDIO_LLM_MAX_TOKENS (default: 8192) to prevent LLM response truncation
      when generating structured JSON outputs (fixes Hierarchical + JSON validation errors)
    • Add RQ_WORKER_TTL_FAILURE (default: 86400 = 1 day) for failed job retention in Redis

    Tested locally with parallel optimization runs (5 concurrent workers):

    • Confirmed parallel execution works correctly
    • Memory usage remains stable (~200MB per worker)
    • Max tokens default fixes truncation errors with Hierarchical optimizer + JSON validation
    • Update Helm documentation

    • Revision 2: Fix comment inconsistency (default 8192) and add env var usage in Python code

    • Revision 3: Defensive env var parsing and fix RQ 2.x handle_job_failure signature

    • Revision 4: Address PR review - DRY env parsing and narrow exception handling

    • Add get_env_int() utility to env_utils.py for defensive env var parsing
    • Use get_env_int() in metrics_worker.py and optimizers.py (removes duplicate try/except)
    • Define RQ_WORKERS_SET_KEY and RQ_WORKER_KEY_PREFIX constants in rq_worker_manager.py
    • Narrow exception handling in _cleanup_stale_workers() to redis.exceptions.ResponseError
      and redis.exceptions.RedisError instead of broad Exception catch
    • Revision 5: Fix flaky test_executor_with_logging_module test

    The test was failing intermittently because it expected logs in a specific
    order, but stdout and stderr are separate streams that can interleave
    unpredictably. Changed to order-independent validation by matching logs
    on message content instead of strict positional ordering.

    Also fixed pre-existing lint issues (unused imports, undefined logger).


    Co-authored-by: CometActions github-actions@comet.com

    下载附件