Skip to content

Conversation

@ftakelait
Copy link
Contributor

Summary

Migrates conf imports in the Celery provider from airflow.configuration to airflow.providers.common.compat.sdk for Airflow 3.x SDK compatibility.

Changes Made

Import Migration (9 files)

  • celery_executor.py
  • celery_executor_utils.py (2 imports)
  • celery_kubernetes_executor.py
  • celery_command.py
  • default_celery.py
  • Test files (4 files)

Fallback Parameters Added

Added fallback parameters to conf.get() calls that execute at module import time:

File Config Key Fallback
celery_executor.py FLOWER_HOST "0.0.0.0"
celery_executor.py FLOWER_PORT 5555
celery_executor.py FLOWER_URL_PREFIX ""
celery_executor.py FLOWER_BASIC_AUTH ""
celery_executor.py DEFAULT_QUEUE "default"
celery_executor.py worker_concurrency 16
celery_executor.py SYNC_PARALLELISM 0
celery_executor.py task_publish_max_retries 3
celery_executor_utils.py operation_timeout 1.0
celery_executor_utils.py CELERY_APP_NAME "airflow.executors.celery_executor"
default_celery.py SSL_ACTIVE False

Why fallbacks are needed?

The SDK conf.get() is stricter than airflow.configuration.conf.get() - it raises AirflowConfigException when a key is not found instead of returning None. This was causing test collection failures when config keys were accessed at module import time before provider configuration was loaded.

Part of #60000

Replace imports of `from airflow.configuration import conf` with
`from airflow.providers.common.compat.sdk import conf` for Airflow 3.x
compatibility.

Add fallback parameters to conf.get() calls that execute at module
import time to prevent AirflowConfigException when config keys are
not yet loaded.

Part of apache#60000

Signed-off-by: Fouzi Takelait <[email protected]>
ARG_BROKER_API = Arg(("-a", "--broker-api"), help="Broker API")
ARG_FLOWER_HOSTNAME = Arg(
("-H", "--hostname"),
default=conf.get("celery", "FLOWER_HOST"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need defaults?

@ftakelait ftakelait requested a review from sunank200 January 2, 2026 17:48
@potiuk
Copy link
Member

potiuk commented Jan 7, 2026

Still working on it @ftakelait ? are you going to rebase and fix the comments ?

@ftakelait
Copy link
Contributor Author

Still working on it @ftakelait ? are you going to rebase and fix the comments ?

Hi @potiuk, I am still waiting for @sunank200 to reply about whether I should keep the fallback or I baypass the testing stage.

@potiuk
Copy link
Member

potiuk commented Jan 7, 2026

I have not seen your question - it's not visible here - I don't think @sunank200 is rather waiting for you - looking at the comments in PR.

#60074 (comment) is where we discussed how to fix it - and hopefully it will be fixed there

But you can still rebase though and keep on solving conflicts. That would be my recommendation while waiting for mechanism implemented for k8s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants