Overview
Some Executors, currently a subset of the local Executors, run in a single threaded fashion and have certain limitations and requirements, many of which are hardcoded. To add a new single threaded Executor would require changes to core Airflow code.
Note: This coupling often shows up with SQLite compatibility checks since it does not support multiple connections.
Examples
- 2a) SQLite check done in configuration.py:
|
is_executor_without_sqlite_support = self.get("core", "executor") not in ( |
|
'DebugExecutor', |
|
'SequentialExecutor', |
|
) |
|
is_sqlite = "sqlite" in self.get('database', 'sql_alchemy_conn') |
|
if is_sqlite and is_executor_without_sqlite_support: |
|
raise AirflowConfigException(f"error: cannot use sqlite with the {self.get('core', 'executor')}") |
|
if is_sqlite: |
- 2b) When running in standalone mode SQLite compatibility is checked:
|
if "sqlite" in conf.get("database", "sql_alchemy_conn"): |
|
self.print_output("standalone", "Forcing executor to SequentialExecutor") |
|
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.SEQUENTIAL_EXECUTOR |
|
else: |
|
self.print_output("standalone", "Forcing executor to LocalExecutor") |
|
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.LOCAL_EXECUTOR |
- 2c) Sensors in
poke mode can block execution of DAGs when running with single process Executors, currently hardcoded to DebugExecutor (although should also include SequentialExecutor):
|
if conf.get('core', 'executor') == "DebugExecutor": |
Proposal
A static method or attribute on the Executor class which can be checked by core code.
There is a precedent already set with the supports_ad_hoc_ti_run attribute, see:
|
supports_ad_hoc_ti_run: bool = True |
|
if not getattr(executor, "supports_ad_hoc_ti_run", False): |
|
msg = "Only works with the Celery, CeleryKubernetes or Kubernetes executors" |
|
return redirect_or_json(origin, msg, "error", 400) |
Overview
Some Executors, currently a subset of the local Executors, run in a single threaded fashion and have certain limitations and requirements, many of which are hardcoded. To add a new single threaded Executor would require changes to core Airflow code.
Note: This coupling often shows up with SQLite compatibility checks since it does not support multiple connections.
Examples
airflow/airflow/configuration.py
Lines 412 to 419 in 26f94c5
airflow/airflow/cli/commands/standalone_command.py
Lines 160 to 165 in 26f94c5
pokemode can block execution of DAGs when running with single process Executors, currently hardcoded to DebugExecutor (although should also include SequentialExecutor):airflow/airflow/sensors/base.py
Line 243 in 27e2101
Proposal
A static method or attribute on the Executor class which can be checked by core code.
There is a precedent already set with the
supports_ad_hoc_ti_runattribute, see:airflow/airflow/executors/kubernetes_executor.py
Line 435 in fb741fd
airflow/airflow/www/views.py
Lines 1735 to 1737 in 26f94c5