This is an automated email from the ASF dual-hosted git repository.
onikolas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 1769ed0b65 Extra input validation for multiple executors (#39067)
1769ed0b65 is described below
commit 1769ed0b65cae00005e7c8b373cbb941eecd051e
Author: Niko Oliveira <[email protected]>
AuthorDate: Wed Apr 17 14:42:40 2024 -0700
Extra input validation for multiple executors (#39067)
Ensure the user provides the module path as the second portion of the
alias:module_path input, not the other way around
---
airflow/executors/executor_loader.py | 7 ++++---
tests/executors/test_executor_loader.py | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/airflow/executors/executor_loader.py
b/airflow/executors/executor_loader.py
index 9f07706a44..83aeb77e50 100644
--- a/airflow/executors/executor_loader.py
+++ b/airflow/executors/executor_loader.py
@@ -120,10 +120,11 @@ class ExecutorLoader:
# complicated. Multiple Executors of the same type will be
supported by a future multitenancy
# AIP.
# The module component should always be a module or plugin
path.
- if not split_name[1] or split_name[1] in CORE_EXECUTOR_NAMES:
+ module_path = split_name[1]
+ if not module_path or module_path in CORE_EXECUTOR_NAMES or
"." not in module_path:
raise AirflowConfigException(
- f"Incorrectly formatted executor configuration:
{name}\n"
- "second portion of an executor configuration must be a
module path"
+ "Incorrectly formatted executor configuration. Second
portion of an executor "
+ f"configuration must be a module path or plugin but
received: {module_path}"
)
else:
executor_names.append(ExecutorName(alias=split_name[0],
module_path=split_name[1]))
diff --git a/tests/executors/test_executor_loader.py
b/tests/executors/test_executor_loader.py
index e0061b2c3a..840e74a8fc 100644
--- a/tests/executors/test_executor_loader.py
+++ b/tests/executors/test_executor_loader.py
@@ -205,6 +205,7 @@ class TestExecutorLoader:
"LocalExecutor, CeleryExecutor:, DebugExecutor",
"LocalExecutor, my_cool_alias:",
"LocalExecutor, my_cool_alias:CeleryExecutor",
+ "LocalExecutor, module.path.first:alias_second",
],
)
def
test_get_hybrid_executors_from_config_core_executors_bad_config_format(self,
executor_config):