georborodin commented on a change in pull request #17426: URL: https://github.com/apache/airflow/pull/17426#discussion_r684139638
########## File path: airflow/cli/cli_parser.py ########## @@ -60,10 +62,17 @@ def _check_value(self, action, value): if action.dest == 'subcommand' and value == 'celery': executor = conf.get('core', 'EXECUTOR') if executor not in (CELERY_EXECUTOR, CELERY_KUBERNETES_EXECUTOR): - message = ( - f'celery subcommand works only with CeleryExecutor, your current executor: {executor}' - ) - raise ArgumentError(action, message) + executor_cls = import_string(ExecutorLoader.executors.get(executor, executor)) Review comment: @potiuk here's why I went with the `import_string` approach at first: `CeleryKubernetesExecutor`-based executors require celery_execytor and kubernetes_executor to be instantiated and passed to it at `__init__(self, celery_executor, kubernetes_executor)`, so the Celery-related command would still require Kubernetes dependencies installed. `ExecuterLoader.get_default_executor()` would still instantiate an executor object. May I suggest splitting up methods in `ExecutorLoader` so that there would be a method for getting executor class by string name? -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org