potiuk commented on code in PR #29055:
URL: https://github.com/apache/airflow/pull/29055#discussion_r1278260420


##########
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:
   Also: note @o-nikolas how much the "specific" message is needed. 
   
   Put yourself in the shoes of a new user, who read somewhere that in order to 
use Celery executor, they need to set the env variable (but did not have celery 
provider installed and has no idea it needs to be added - because they have not 
read and digested the docs, they are just experimenting).
   
   If you **just** print the exception and no extra message, the user would be 
at a total loss on what to do because the import error would not be telling 
anythong to the user who would not know that they have to installl celery 
provider. They would just see import error and no further explanation. With the 
extra message, we make it very clear what the problem very likely is and give 
the user clear instruction what to do to fix the problem.
   
   Without it, we invite the uer to simply open an issue to Airflow and say 
"Airflow does not work - I have that exception, what do I do ?". With this 
extra message we - in vast majority of cases - prevent that question even being 
asked because we provide an answer to it before the user asks it.



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