Skip to content

Create an airflow upgrade-check command in 1.10 to ease upgrade path to 2.0. #8765

@ashb

Description

@ashb

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:

  • HostnameCallableRule - Unify hostname_callable option in core section Create HostnameCallableRule to ease upgrade to Airflow 2.0 #11044
  • StatNameHandlerNotSupportedRule - Drop plugin support for stat_name_handler
  • LoggingConfigurationRule - Logging configuration has been moved to new section
  • NoGCPServiceAccountKeyInConfigRule - Remove gcp_service_account_keys option in airflow.cfg file
  • FernetEnabledRule - Fernet is enabled by default
  • KubernetesWorkerAnnotationsRule - Changes to propagating Kubernetes worker annotations
  • LegacyUIDeprecatedRule - Deprecate legacy UI in favor of FAB RBAC UI
  • TaskHandlersMovedRule - GCSTaskHandler has been moved, WasbTaskHandler has been moved, StackdriverTaskHandler has been moved , S3TaskHandler has been moved, ElasticsearchTaskHandler has been moved, CloudwatchTaskHandler has been moved
  • SendGridMovedRule - SendGrid emailer has been moved
  • CustomExecutorsRequireFullPathRule - Custom executors is loaded using full import path

Import changes:

  • ImportChangesRule - uses a map old_operator_name -> list of possible problems so 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 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.

Metadata

Metadata

Assignees

Labels

area:upgradeFacilitating migration to a newer version of Airflowkind:metaHigh-level information important to the community

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions