Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create CustomExecutorsRequireFullPathRule to ease upgrade to Airflow 2.0 #11053

Closed
turbaszek opened this issue Sep 21, 2020 · 8 comments
Closed
Assignees
Labels
area:upgrade Facilitating migration to a newer version of Airflow good first issue kind:feature Feature Requests upgrade-check upgrade-check CLI

Comments

@turbaszek
Copy link
Member

This issue is part of #8765

Rule

Create CustomExecutorsRequireFullPathRule which corresponds to

Custom executors is loaded using full import path

entry in UPDATING.md. This rule should allow users to check if their current configuration needs any adjusting
before migration to Airflow 2.0.

How to guide

To implement a new rule, 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
)

Remember to open the PR against v1-10-test branch.

@turbaszek turbaszek added area:upgrade Facilitating migration to a newer version of Airflow kind:feature Feature Requests good first issue labels Sep 21, 2020
@turbaszek turbaszek added this to the Airflow 1.10.13 milestone Sep 21, 2020
@pcandoalmeida
Copy link
Contributor

Hi @turbaszek could I try working on this?

@potiuk
Copy link
Member

potiuk commented Sep 21, 2020

I assigned you :)

@turbaszek
Copy link
Member Author

@pcandoalmeida in case of any questions feel free to ask 👌

@turbaszek turbaszek moved this from To do to In progress in Airflow upgrade check Sep 22, 2020
@kaxil kaxil added the upgrade-check upgrade-check CLI label Oct 30, 2020
@dimberman
Copy link
Contributor

Hi @pcandoalmeida have you made any progress on this ticket? If you do not have time I can take it over.

@pcandoalmeida
Copy link
Contributor

Hi @dimberman yes by all means!

@dimberman dimberman assigned dimberman and unassigned pcandoalmeida Nov 25, 2020
@dimberman
Copy link
Contributor

@turbaszek @kaxil I'm a bit confused by this

https://github.com/apache/airflow/blob/master/airflow/executors/executor_loader.py#L81-L110 Looking at these lines it looks like Airflow 2.0 still allows loading from plugins? Does this need to be an upgrade check or deprecation warning?

@kaxil
Copy link
Member

kaxil commented Jan 13, 2021

@turbaszek Is there a rule to do the same (use normal Python package / modules) for operators and sensors?

I couldn't find one but we removed the support for adding operators and sensors via Plugins so we should have a check for it.

@kaxil
Copy link
Member

kaxil commented Jan 20, 2021

closed by #13678

@kaxil kaxil closed this as completed Jan 20, 2021
Airflow upgrade check automation moved this from In progress to Done Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:upgrade Facilitating migration to a newer version of Airflow good first issue kind:feature Feature Requests upgrade-check upgrade-check CLI
Projects
No open projects
Development

No branches or pull requests

6 participants