Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support LocalExecutor #138

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions images/airflow/2.9.2/python/mwaa/config/airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ def _get_essential_airflow_celery_config() -> Dict[str, str]:
"""
celery_config_module_path = "mwaa.config.celery.MWAA_CELERY_CONFIG"

return {
"AIRFLOW__CELERY_BROKER_TRANSPORT_OPTIONS__VISIBILITY_TIMEOUT": "43200",
"AIRFLOW__CELERY__BROKER_URL": get_sqs_endpoint(),
"AIRFLOW__CELERY__CELERY_CONFIG_OPTIONS": celery_config_module_path,
"AIRFLOW__CELERY__RESULT_BACKEND": f"db+{get_db_connection_string()}",
"AIRFLOW__CELERY__WORKER_ENABLE_REMOTE_CONTROL": "False",
# These two are not Celery configs per-se, but are used by the Celery executor.
"AIRFLOW__CORE__EXECUTOR": "CeleryExecutor",
"AIRFLOW__OPERATORS__DEFAULT_QUEUE": get_sqs_queue_name(),
}
executor_type = os.environ.get("MWAA__CORE__EXECUTOR_TYPE", "CeleryExecutor").lower()
agupta01 marked this conversation as resolved.
Show resolved Hide resolved

if executor_type == 'localexecutor':
return {
"AIRFLOW__CORE__EXECUTOR": "LocalExecutor", # Default to LocalExecutor if no SQS queue is present
agupta01 marked this conversation as resolved.
Show resolved Hide resolved
}
else:
return {
"AIRFLOW__CELERY_BROKER_TRANSPORT_OPTIONS__VISIBILITY_TIMEOUT": "43200",
"AIRFLOW__CELERY__BROKER_URL": get_sqs_endpoint(),
"AIRFLOW__CELERY__CELERY_CONFIG_OPTIONS": celery_config_module_path,
"AIRFLOW__CELERY__RESULT_BACKEND": f"db+{get_db_connection_string()}",
"AIRFLOW__CELERY__WORKER_ENABLE_REMOTE_CONTROL": "False",
# These two are not Celery configs per-se, but are used by the Celery executor.
agupta01 marked this conversation as resolved.
Show resolved Hide resolved
"AIRFLOW__CORE__EXECUTOR": "CeleryExecutor",
"AIRFLOW__OPERATORS__DEFAULT_QUEUE": get_sqs_queue_name(),
}


def _get_essential_airflow_core_config() -> Dict[str, str]:
Expand Down
5 changes: 3 additions & 2 deletions images/airflow/2.9.2/python/mwaa/config/sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ def should_create_queue() -> bool:

:return: True or False.
"""
return os.environ.get("MWAA__SQS__CREATE_QUEUE", "false").lower() == "true"

executor_type = os.environ.get("MWAA__CORE__EXECUTOR_TYPE", "CeleryExecutor").lower()
create_queue = os.environ.get("MWAA__SQS__CREATE_QUEUE", "false").lower()
return (executor_type == "celeryexecutor") and (create_queue == "true")

def should_use_ssl() -> bool:
"""
Expand Down
Loading