Skip to content

Fix celery autoscaler hmi_config usage and DEPLOY_SERVICE_CONFIG_PATH#772

Merged
dmchoiboi merged 1 commit intomainfrom
dmchoi/fix-celery-autoscaler-bugs
Feb 27, 2026
Merged

Fix celery autoscaler hmi_config usage and DEPLOY_SERVICE_CONFIG_PATH#772
dmchoiboi merged 1 commit intomainfrom
dmchoi/fix-celery-autoscaler-bugs

Conversation

@dmchoiboi
Copy link
Collaborator

@dmchoiboi dmchoiboi commented Feb 27, 2026

Fixes two bugs introduced by PRs #770 and #771

Both bugs caused the Celery Autoscaler to fail in prod with errors on every loop iteration. Fix was validated in prod before this PR.

Bug 1: hmi_config is not callable (celery_autoscaler.py)

PR #770 added hmi_config().endpoint_namespace but hmi_config is an instance, not a function:

TypeError: 'HostedModelInferenceServiceConfig' object is not callable

Fix: hmi_config().endpoint_namespacehmi_config.endpoint_namespace

Bug 2: DEPLOY_SERVICE_CONFIG_PATH wrong for config.file mode (celery_autoscaler_stateful_set.yaml)

PR #771 hardcoded the path to the ConfigMap-mounted config, but prod uses config.file (config baked into the private image at a known path — no ConfigMap created):

FileNotFoundError: /workspace/model-engine/service_configs/service_config.yaml

Fix: set DEPLOY_SERVICE_CONFIG_PATH to config.file.launch when config.file is set (prod), falling back to the ConfigMap path when config.values is set.

Test plan

  • Deployed to prod and verified autoscaler loops run without errors
  • Autoscaler correctly reads endpoint_namespace: scale-deploy from config
  • Queue depth reporting working (Inflight: ... : N)

🤖 Generated with Claude Code

Greptile Summary

Fixes two production-breaking bugs introduced by PRs #770 and #771 in the Celery Autoscaler. Both fixes are minimal and correct.

  • celery_autoscaler.py: Removes erroneous () call on hmi_config, which is an already-instantiated HostedModelInferenceServiceConfig object — not a factory function. This was causing a TypeError on every autoscaler loop iteration.
  • celery_autoscaler_stateful_set.yaml: Adds conditional DEPLOY_SERVICE_CONFIG_PATH logic matching the existing pattern in _helpers.tpl — uses config.file.launch for prod (config baked into image) and falls back to the ConfigMap-mounted path for config.values mode.

Confidence Score: 5/5

  • This PR is safe to merge — it fixes two clear prod-breaking bugs with minimal, well-validated changes.
  • Both changes are single-line fixes for obvious bugs (calling a non-callable object, wrong config path). The fixes are consistent with existing patterns in the codebase and have been validated in production.
  • No files require special attention.

Important Files Changed

Filename Overview
model-engine/model_engine_server/core/celery/celery_autoscaler.py Fixes hmi_config()hmi_config — removes erroneous call on an already-instantiated config object. Consistent with all other usages across the codebase.
charts/model-engine/templates/celery_autoscaler_stateful_set.yaml Adds conditional DEPLOY_SERVICE_CONFIG_PATH logic: uses config.file.launch when config.file is set, falls back to ConfigMap path for config.values. Pattern matches _helpers.tpl exactly.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Celery Autoscaler Starts] --> B[Import hmi_config]
    B --> C[Access hmi_config.endpoint_namespace]
    C --> D[list_namespaced_deployment]
    D --> E[Process Deployments]

    F[Helm Template Rendering] --> G{config.file set?}
    G -->|Yes| H[DEPLOY_SERVICE_CONFIG_PATH = config.file.launch]
    G -->|No| I{config.values set?}
    I -->|Yes| J[DEPLOY_SERVICE_CONFIG_PATH = ConfigMap path]
    I -->|No| K[No DEPLOY_SERVICE_CONFIG_PATH set]
Loading

Last reviewed commit: 5c22484

@dmchoiboi dmchoiboi enabled auto-merge (squash) February 27, 2026 06:19
@dmchoiboi dmchoiboi merged commit 2f90478 into main Feb 27, 2026
8 checks passed
@dmchoiboi dmchoiboi deleted the dmchoi/fix-celery-autoscaler-bugs branch February 27, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants