Skip to content

Conversation

@ashb
Copy link
Member

@ashb ashb commented Nov 3, 2020

This adds two warnings -- one at registration time:

/home/ash/airflow/plugins/example.py:27: FutureWarning: Registering operator or sensors in plugins is deprecated -- these should be treated like 'plain' python modules, and imported normally in DAGs. Airflow 2.0 has removed the ability to register these types in plugins
  class AstroLinksPlugin(AirflowPlugin):

(The source/file shown here is the class line of the defining plugin.)

And a second at import time:

/home/ash/airflow/dags/foo.py:1: FutureWarning: Importing 'MyOperator' from under 'airflow.operators.*' has been deprecated and should be directly imported as 'example.MyOperator' instead. Support for importing from within the airflow namespace for plugins will be dropped entirely in Airflow 2.0.
  from airflow.operators.astronomer_menu_links import MyOperator

(The source here is where the import is used - i.e. in the DAG)

Closes #9500


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@ashb ashb requested a review from kaxil November 3, 2020 15:28
@ashb ashb force-pushed the deprecate-operators-via-plugins branch 2 times, most recently from a5b4369 to 636a2f5 Compare November 3, 2020 17:41
kaxil pushed a commit to astronomer/airflow that referenced this pull request Nov 4, 2020
We have deprecated this in apache#12069 (for inclusion in 1.10.13) and the
docs http://airflow.apache.org/docs/stable/howto/custom-operator.html
already show how to do this without a plugin.

Closes apache#9498
kaxil pushed a commit that referenced this pull request Nov 4, 2020
We have deprecated this in #12069 (for inclusion in 1.10.13) and the
docs http://airflow.apache.org/docs/stable/howto/custom-operator.html
already show how to do this without a plugin.

Closes #9498
@ashb ashb force-pushed the deprecate-operators-via-plugins branch from 636a2f5 to d2bb3f3 Compare November 4, 2020 12:36
@ashb ashb changed the base branch from v1-10-test to v1-10-stable November 4, 2020 16:39
@ashb ashb force-pushed the deprecate-operators-via-plugins branch from d2bb3f3 to b0672c1 Compare November 4, 2020 16:40
@ashb
Copy link
Member Author

ashb commented Nov 4, 2020

D'oh. Using pep562 like this is barfing if the plugins aren't valid module names, such as plugin-b.py.

No, I just did a stupid :) Hopefully an easy fix.

@ashb ashb force-pushed the deprecate-operators-via-plugins branch from b0672c1 to f8f4319 Compare November 4, 2020 20:43
@github-actions
Copy link

github-actions bot commented Nov 4, 2020

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@ashb ashb force-pushed the deprecate-operators-via-plugins branch 2 times, most recently from ea0807a to ba4122f Compare November 5, 2020 09:55
This adds two imports -- one at registration time:

```
/home/ash/airflow/plugins/example.py:27: FutureWarning: Registering operator or sensors in plugins is deprecated -- these should be treated like 'plain' python modules, and imported normally in DAGs.

Airflow 2.0 has removed the ability to register these types in plugins. See <http://airflow.apache.org/docs/stable/howto/custom-operator.html>.
  class LinksPlugin(AirflowPlugin):
```

(The source/file shown here is the `class` line of the defining plugin.)

And a second at import time:

```
/home/ash/airflow/dags/foo.py:1: FutureWarning: Importing 'MyOperator' from under 'airflow.operators.*' has been deprecated and should be directly imported as 'example.MyOperator' instead.

Support for importing from within the airflow namespace for plugins will be dropped entirely in Airflow 2.0. See <http://airflow.apache.org/docs/stable/howto/custom-operator.html>.
  from airflow.operators.links_plugin import MyOperator
```

(The source here is where the import is used - i.e. in the DAG)

Closes apache#9500
@ashb ashb force-pushed the deprecate-operators-via-plugins branch from ba4122f to 90b1128 Compare November 5, 2020 11:20
@ashb
Copy link
Member Author

ashb commented Nov 5, 2020

Just random failures left. Merging now.

@ashb ashb merged commit fc40a49 into apache:v1-10-stable Nov 5, 2020
@ashb ashb deleted the deprecate-operators-via-plugins branch November 5, 2020 12:11
@potiuk potiuk added this to the Airflow 1.10.13 milestone Nov 14, 2020
cfei18 pushed a commit to cfei18/incubator-airflow that referenced this pull request Mar 5, 2021
This adds two warnings -- one at registration time:

```
/home/ash/airflow/plugins/example.py:27: FutureWarning: Registering operator or sensors in plugins is deprecated -- these should be treated like 'plain' python modules, and imported normally in DAGs.

Airflow 2.0 has removed the ability to register these types in plugins. See <http://airflow.apache.org/docs/stable/howto/custom-operator.html>.
  class LinksPlugin(AirflowPlugin):
```

(The source/file shown here is the `class` line of the defining plugin.)

And a second at import time:

```
/home/ash/airflow/dags/foo.py:1: FutureWarning: Importing 'MyOperator' from under 'airflow.operators.*' has been deprecated and should be directly imported as 'example.MyOperator' instead.

Support for importing from within the airflow namespace for plugins will be dropped entirely in Airflow 2.0. See <http://airflow.apache.org/docs/stable/howto/custom-operator.html>.
  from airflow.operators.links_plugin import MyOperator
```

(The source here is where the import is used - i.e. in the DAG)

Closes apache#9500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants