You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Timo (JIRA)" <ji...@apache.org> on 2016/06/20 15:20:05 UTC
[jira] [Commented] (AIRFLOW-98) Using Flask extensions from a
plugin
[ https://issues.apache.org/jira/browse/AIRFLOW-98?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15339691#comment-15339691 ]
Timo commented on AIRFLOW-98:
-----------------------------
Since the app instance is not yet created when the plugins are imported, I tried to initialise the app in the plugin itself:
{code:none}
from airflow import configuration as conf
from airflow.www.app import cached_app
app = cached_app(conf)
{code}
This fails. Most likely it's causing a circular import, but I'm not sure about that. Traceback:
{code:none}
[2016-06-20 04:59:31,609] {plugins_manager.py:75} ERROR - cannot import name admin_views
Traceback (most recent call last):
File "local/lib/python2.7/site-packages/airflow/plugins_manager.py", line 64, in <module>
m = imp.load_source(namespace, filepath)
File "/airflow/plugins/operators.py", line 14, in <module>
app = cached_app(conf)
File "/local/lib/python2.7/site-packages/airflow/www/app.py", line 133, in cached_app
app = create_app(config)
File "/local/lib/python2.7/site-packages/airflow/www/app.py", line 115, in create_app
integrate_plugins()
File "/local/lib/python2.7/site-packages/airflow/www/app.py", line 106, in integrate_plugins
from airflow.plugins_manager import (
ImportError: cannot import name admin_views
{code}
> Using Flask extensions from a plugin
> ------------------------------------
>
> Key: AIRFLOW-98
> URL: https://issues.apache.org/jira/browse/AIRFLOW-98
> Project: Apache Airflow
> Issue Type: Wish
> Reporter: Timo
> Priority: Minor
>
> I am creating a plugin which should be able to use some Flask extensions. Is there any way to do this?
> Basically I need to import the airflow.www.app.app object in the plugin to initialise the extension with.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)