potiuk commented on code in PR #29055:
URL: https://github.com/apache/airflow/pull/29055#discussion_r1277952894
##########
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. Otherwise the user will be completely unaware what might be the
reason and when the user raises issue "my airflow does not work, what should I
do?" - not even the user but also whoever looks at it in GitHub issues will
have no clue either, because the actual exception will be swallowed and we will
have no clue how to help the user.
Ideally we should also separately handle ImportError specifically,
separately. Having an ImportError is a clear indication that the user has no
right provider installed or no provider at alll. This will be probably 9X% of
import errors here, so we can give the user a much more specific error:
1) first of all print the exact exception message that might give the exact
import error.
2) 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.
--
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]