ashb commented on a change in pull request #12657:
URL: https://github.com/apache/airflow/pull/12657#discussion_r531779337
##########
File path: airflow/upgrade/checker.py
##########
@@ -45,19 +46,44 @@ def register_arguments(subparser):
"-s", "--save",
help="Saves the result to the indicated file. The file format is
determined by the file extension."
)
+ subparser.add_argument(
+ "-i", "--ignore",
+ help="Ignore a rule. Can be used multiple times.",
+ action='append',
+ )
+ subparser.add_argument(
+ "-c", "--config",
+ help="Path to upgrade check config yaml file.",
+ )
subparser.set_defaults(func=run)
def run(args):
from airflow.upgrade.formatters import (ConsoleFormatter, JSONFormatter)
+ from airflow.upgrade.config import UpgradeConfig
+
if args.save:
filename = args.save
if not filename.lower().endswith(".json"):
exit("Only JSON files are supported")
formatter = JSONFormatter(args.save)
else:
formatter = ConsoleFormatter()
- all_problems = check_upgrade(formatter)
+
+ if args.ignore:
+ rules = [r for r in ALL_RULES if r.__class__.__name__ not in
args.ignore]
+ else:
+ rules = ALL_RULES
+
+ if args.config:
+ print("Using config file from:", args.config)
+ upgrade_config = UpgradeConfig.read(path=args.config)
+ rules = upgrade_config.register_custom_rules(rules)
+ rules = upgrade_config.remove_ignored_rules(rules)
+
+ logging.disable(logging.WARNING)
Review comment:
And if
https://github.com/apache/airflow/commit/f47efe91a8b4ba5ba43fa8d55990d27516ab0b6c#diff-62e7779cba210540c1bb87f26ce56a6176941d024635c606bcf360c14b4a9e12
isn't needed anymore as a result then you should remove 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.
For queries about this service, please contact Infrastructure at:
[email protected]