To make it easier for users to upgrade from 1.10 to 2.0 (when it eventually comes out) we should create a single upgrade-check command in 1.10 that checks the following things. We could also have a mode that makes some of these changes in place (with confirmation from user) to automate it.
Rules
Major breaking changes:
Config related changes:
Import changes:
How to guide
To implement a new rule we had to create a class that inherits from airflow.upgrade.rules.base_rule.BaseRule. It will be auto-registered and used by airflow upgrade-check command. The custom rule class has to have title, description properties and should implement check method which returns a list of error messages in case of incompatibility.
For example:
|
class ConnTypeIsNotNullableRule(BaseRule): |
|
|
|
title = "Connection.conn_type is not nullable" |
|
|
|
description = """\ |
|
The `conn_type` column in the `connection` table must contain content. Previously, this rule was \ |
|
enforced by application logic, but was not enforced by the database schema. |
|
|
|
If you made any modifications to the table directly, make sure you don't have null in the conn_type column.\ |
|
""" |
|
|
|
@provide_session |
|
def check(self, session=None): |
|
invalid_connections = session.query(Connection).filter(Connection.conn_type.is_(None)) |
|
return ( |
|
'Connection<id={}", conn_id={}> have empty conn_type field.'.format(conn.id, conn.conn_id) |
|
for conn in invalid_connections |
|
) |
Remeber to open the PR against v1-10-test branch.
To make it easier for users to upgrade from 1.10 to 2.0 (when it eventually comes out) we should create a single
upgrade-checkcommand in 1.10 that checks the following things. We could also have a mode that makes some of these changes in place (with confirmation from user) to automate it.Rules
Major breaking changes:
ConnTypeIsNotNullableRule- Not-nullable conn_type column in connection table (done)UniqueConnIdRule- Unique conn_id in connection table Add UniqueConnIdRule rule and unittest #11222CutomOperatorUsesMetaclassRule- BaseOperator uses metaclass Create CustomOperatorUsesMetaclassRule to ease upgrade to Airflow 2.0 #11038UsingSQLFromBaseHookRule- Remove SQL support in base_hook Create UsingSQLFromBaseHookRule to ease upgrade to Airflow 2.0 #11039ChainBetwenDAGAndOperatorNotAllowedRule- Assigning task to a DAG using bitwise shift (bit-shift) operators are no longer supportedAirflowMacroPluginRemovedRule- Removal of airflow.AirflowMacroPlugin classNoAdditionalArgsInOperatorsRule- Additional arguments passed to BaseOperator cause an exception Create NoAdditionalArgsInOperatorsRule to ease upgrade to Airflow 2.0 #11042MesosExecutorRemovedRule- Removal of Mesos ExecutorConfig related changes:
HostnameCallableRule- Unifyhostname_callableoption incoresection Create HostnameCallableRule to ease upgrade to Airflow 2.0 #11044StatNameHandlerNotSupportedRule- Drop plugin support for stat_name_handlerLoggingConfigurationRule- Logging configuration has been moved to new sectionNoGCPServiceAccountKeyInConfigRule- Remove gcp_service_account_keys option in airflow.cfg fileFernetEnabledRule- Fernet is enabled by defaultKubernetesWorkerAnnotationsRule- Changes to propagating Kubernetes worker annotationsLegacyUIDeprecatedRule- Deprecate legacy UI in favor of FAB RBAC UITaskHandlersMovedRule- GCSTaskHandler has been moved, WasbTaskHandler has been moved, StackdriverTaskHandler has been moved , S3TaskHandler has been moved, ElasticsearchTaskHandler has been moved, CloudwatchTaskHandler has been movedSendGridMovedRule- SendGrid emailer has been movedCustomExecutorsRequireFullPathRule- Custom executors is loaded using full import pathImport changes:
ImportChangesRule- uses a mapold_operator_name -> list of possible problemsso we can create a single DagBag and scan all used operators and raise information about changes. It should also suggest what providers packages users should use.How to guide
To implement a new rule we had to create a class that inherits from
airflow.upgrade.rules.base_rule.BaseRule. It will be auto-registered and used byairflow upgrade-checkcommand. The custom rule class has to havetitle,descriptionproperties and should implementcheckmethod which returns a list of error messages in case of incompatibility.For example:
airflow/airflow/upgrade/rules/conn_type_is_not_nullable.py
Lines 25 to 42 in ea36166
Remeber to open the PR against
v1-10-testbranch.