o-nikolas commented on code in PR #28934:
URL: https://github.com/apache/airflow/pull/28934#discussion_r1082935302
##########
airflow/cli/commands/standalone_command.py:
##########
@@ -159,14 +159,28 @@ def calculate_env(self):
# Make sure we're using a local executor flavour
executor_class, _ = ExecutorLoader.import_default_executor_cls()
if not executor_class.is_local:
- 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
+ env["AIRFLOW__CORE__EXECUTOR"] = self.get_local_executor(
+ database=conf.get("database", "sql_alchemy_conn")
+ )
+ self.print_output("standalone", f"Forcing executor to
{env['AIRFLOW__CORE__EXECUTOR']}")
Review Comment:
> The only benefit I see with this code we still remove the need to change
this part of the code if someone implements a new local executor, right?
If someone develops a new local executor, they are able to use it just fine
and they do not need to touch this code. This code is only run if the user
fails to use a compatible executor for the standalone setup (`if not
executor_class.is_local:`), in which case we choose a workable default for
them. I don't think that this defaulting code needs to be pluggable or updated
if new executors are added. Because if the user wishes to use any specific (and
compatible) executor with standalone they're welcome to do that, and it's as
easy as just configuring to use it in airflow.cfg or via
`AIRFLOW__CORE__EXECUTOR`. And if that executor they pick is compatible (i.e.
passes the `is_local` check) then this code is not run.
It is basically another example of coupling type 7 in the original AIP, here
is the snippet:

Hopefully that makes sense, it's a bit of a nuanced issue. It is my bad for
mis-identifing this piece of code as a point of executor coupling :pray:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]