zhongjiajie commented on a change in pull request #7902: Enable celery command 
in any environment
URL: https://github.com/apache/airflow/pull/7902#discussion_r399675764
 
 

 ##########
 File path: airflow/cli/cli_parser.py
 ##########
 @@ -55,6 +55,24 @@ def command(*args, **kwargs):
     return command
 
 
+class DefaultHelpParser(argparse.ArgumentParser):
+    """CustomParser to display help message"""
+
+    def _check_value(self, action, value):
+        """Override _check_value and check conditionally added command"""
+        executor = conf.get('core', 'EXECUTOR')
+        if value == 'celery' and executor != ExecutorLoader.CELERY_EXECUTOR:
+            message = f'celery command works only with CeleryExecutor, your 
current executor: {executor}'
 
 Review comment:
   ```suggestion
               message = f'celery subcommand works only with CeleryExecutor, 
your current executor: {executor}'
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to