o-nikolas commented on code in PR #29055:
URL: https://github.com/apache/airflow/pull/29055#discussion_r1278030846


##########
airflow/cli/cli_parser.py:
##########
@@ -41,10 +42,23 @@
     core_commands,
 )
 from airflow.exceptions import AirflowException
+from airflow.executors.executor_loader import ExecutorLoader
 from airflow.utils.helpers import partition
 
 airflow_commands = core_commands
 
+log = logging.getLogger(__name__)
+try:
+    executor, _ = ExecutorLoader.import_default_executor_cls(validate=False)
+    airflow_commands.extend(executor.get_cli_commands())
+except Exception:
+    executor_name = ExecutorLoader.get_default_executor_name()
+    log.exception("Failed to load CLI commands from executor: %s", 
executor_name)
+    log.error("Ensure all dependencies are met and try again")

Review Comment:
   > I think it would be good to at least print the mesage of the exception 
that caused it.
   
   Yeah, that's fair, and I did try it with this configuration (as well as 
printing the full stack trace) but it really makes the output of the CLI 
commands ugly, and if the user doesn't even care about executor commands 
they're going to see the exception and a large warning every time which is a 
bad user experience as well.
   
   But I can try add it back in again and see how it looks.
   
   > We can add a generic advice: "If your executor is based on Celery - you 
need to install 3.3.0+ version of provider, if it is Kubernetes - yoy need to 
install 7.4.0+ of cncf.kubernetes. While we cannot be sure if this is the 
reason, this will be it in vast majority of cases and might significantly 
incrase the number of cases where the users will be able to install provider 
and solve the problem on their own rather than opening an issue to Airflow.
   
   It feels a bit wrong to me to add this much celery/kubernetes specific 
hardcoding into this generic executor code. I'll try update the general 
exception message I print here to mention the celery/kube versions, but I think 
we should remove those soon in the future.



-- 
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]

Reply via email to