mik-laj commented on a change in pull request #13678: URL: https://github.com/apache/airflow/pull/13678#discussion_r558232343
########## File path: airflow/upgrade/rules/custom_executors_require_full_path_rule.py ########## @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from airflow.configuration import conf +from airflow.upgrade.rules.base_rule import BaseRule + + +class CustomExecutorsRequireFullPathRule(BaseRule): + """ + CustomExecutorsRequireFullPathRule class to ease upgrade to Airflow 2.0 + """ + title = "Custom Executors now require full path" + description = """\ +In Airflow-2.0, loading custom executors via plugins is no longer required. +To load a custom executor, you have to provide a full path to the the custom executor module. + """ + + def check(self): + executor = conf.get(section="core", key="executor") + if executor.count(".") <= 1: Review comment: I think this is not a good solution because the custom executor can be in the main module and then it will only have one dot. This is a common practice for some teams to keep an eye on what is exported out. I think you can try to load this module here using import_string. If we succeed, we have success. If it failed, this value must be checked. ---------------------------------------------------------------- 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]
