Severity: P2 — ops footgun: a pyworkflow.config.yaml in cwd silently overrides PYWORKFLOW_CELERY_BROKER, so env-var redirection is ignored.
What happens
Setting PYWORKFLOW_CELERY_BROKER has no effect whenever the worker is started from a directory containing a pyworkflow.config.yaml — the yaml's broker wins with no warning. During isolated testing this nearly pointed a test worker at a production redis: the yaml in examples/celery/durable hard-codes redis://localhost:6379/0 and the env override was silently discarded.
Root cause
cli/commands/worker.py:164-171 loads the cwd yaml (discovery.py:94 resolves cwd/pyworkflow.config.yaml) and merges its celery block; then :196-199:
broker_url = celery_config.get("broker", os.getenv("PYWORKFLOW_CELERY_BROKER", ...))
— the env var is only the fallback default when the yaml key is absent, then the value is passed as an explicit param to create_celery_app (:237-241; celery/app.py:319 is again param or env). Effective precedence is file > env, inverted from the conventional flags > env > file that the CLI docstring implies.
Executed evidence (v0.3.8)
| setup |
worker banner |
cwd yaml broker …:6391/0 + env PYWORKFLOW_CELERY_BROKER=…:6392/0 |
ℹ Broker: redis://localhost:6391/0 (env ignored) |
| same env, yaml removed |
ℹ Broker: redis://localhost:6392/0 |
Suggested fix
Read the env var first (os.getenv("PYWORKFLOW_CELERY_BROKER") or celery_config.get("broker") or default), or at minimum log a warning when a set PYWORKFLOW_* env var is being overridden by a config file.
Severity: P2 — ops footgun: a
pyworkflow.config.yamlin cwd silently overridesPYWORKFLOW_CELERY_BROKER, so env-var redirection is ignored.What happens
Setting
PYWORKFLOW_CELERY_BROKERhas no effect whenever the worker is started from a directory containing apyworkflow.config.yaml— the yaml's broker wins with no warning. During isolated testing this nearly pointed a test worker at a production redis: the yaml inexamples/celery/durablehard-codesredis://localhost:6379/0and the env override was silently discarded.Root cause
cli/commands/worker.py:164-171loads the cwd yaml (discovery.py:94resolvescwd/pyworkflow.config.yaml) and merges itsceleryblock; then:196-199:— the env var is only the fallback default when the yaml key is absent, then the value is passed as an explicit param to
create_celery_app(:237-241;celery/app.py:319is againparam or env). Effective precedence is file > env, inverted from the conventional flags > env > file that the CLI docstring implies.Executed evidence (v0.3.8)
…:6391/0+ envPYWORKFLOW_CELERY_BROKER=…:6392/0ℹ Broker: redis://localhost:6391/0(env ignored)ℹ Broker: redis://localhost:6392/0Suggested fix
Read the env var first (
os.getenv("PYWORKFLOW_CELERY_BROKER") or celery_config.get("broker") or default), or at minimum log a warning when a setPYWORKFLOW_*env var is being overridden by a config file.