[
https://issues.apache.org/jira/browse/AIRFLOW-4304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Piermarini updated AIRFLOW-4304:
---------------------------------------
Description:
Flask Blueprint objects are treated as subscriptable in `app.py`, which raises
an exception that causes the webserver to shut down.
The exception is raised on line 147 of /airflow/www/app.py. In prior versions,
the Blueprint object was retrieved from a dictionary-like flask_blueprints
object by calling bp["blueprint"]. As of 10.3, it appears that flask_blueprints
is loaded as an array of non-subscriptable Blueprint objects on which `name`
and `import_name` can be called directly.
*Exception:*
{code:java}
[2019-04-11 15:09:02 -0700] [54143] [ERROR] Exception in worker process
Traceback (most recent call last):
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/arbiter.py",
line 583, in spawn_worker
worker.init_process()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/workers/base.py",
line 129, in init_process
self.load_wsgi()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/workers/base.py",
line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/base.py",
line 67, in wsgi
self.callable = self.load()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",
line 52, in load
return self.load_wsgiapp()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",
line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/util.py",
line 362, in import_app
app = eval(obj, vars(mod))
File "<string>", line 1, in <module>
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
line 192, in cached_app
app = create_app(config, testing)
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
line 153, in create_app
integrate_plugins()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
line 147, in integrate_plugins
log.debug("Adding blueprint %s:%s", bp["name"], bp["blueprint"].import_name)
TypeError: 'Blueprint' object is not subscriptable
{code}
*Existing Codeblock:*
{code:java}
# www/app.py, lines 138-153
def integrate_plugins():
"""Integrate plugins to the context"""
log = LoggingMixin().log
from airflow.plugins_manager import (
admin_views, flask_blueprints, menu_links)
for v in admin_views:
log.debug('Adding view %s', v.name)
admin.add_view(v)
for bp in flask_blueprints:
log.debug("Adding blueprint %s:%s", bp["name"],
bp["blueprint"].import_name)
app.register_blueprint(bp["blueprint"])
for ml in sorted(menu_links, key=lambda x: x.name):
log.debug('Adding menu link %s', ml.name)
admin.add_link(ml)
integrate_plugins()
{code}
Corrected Codeblock:
{code:java}
# www/app.py, lines 138-153
def integrate_plugins():
"""Integrate plugins to the context"""
log = LoggingMixin().log
from airflow.plugins_manager import (
admin_views, flask_blueprints, menu_links)
for v in admin_views:
log.debug('Adding view %s', v.name)
admin.add_view(v)
for bp in flask_blueprints:
log.debug("Adding blueprint %s:%s", bp.name, bp.import_name)
app.register_blueprint(bp)
for ml in sorted(menu_links, key=lambda x: x.name):
log.debug('Adding menu link %s', ml.name)
admin.add_link(ml)
integrate_plugins(){code}
was:
Flask Blueprint objects are treated as subscriptable in `app.py`, causing an
exception that causes the webserver to shut down.
The exception is raised on line 147 of /airflow/www/app.py. In prior versions,
the Blueprint object was retrieved from a dictionary-like flask_blueprints
object by calling bp["blueprint"]. As of 10.3, it appears that flask_blueprints
is loaded as an array of non-subscriptable Blueprint objects on which `name`
and `import_name` can be called directly.
*Exception:*
{code:java}
[2019-04-11 15:09:02 -0700] [54143] [ERROR] Exception in worker process
Traceback (most recent call last):
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/arbiter.py",
line 583, in spawn_worker
worker.init_process()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/workers/base.py",
line 129, in init_process
self.load_wsgi()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/workers/base.py",
line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/base.py",
line 67, in wsgi
self.callable = self.load()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",
line 52, in load
return self.load_wsgiapp()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",
line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/util.py",
line 362, in import_app
app = eval(obj, vars(mod))
File "<string>", line 1, in <module>
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
line 192, in cached_app
app = create_app(config, testing)
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
line 153, in create_app
integrate_plugins()
File
"/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
line 147, in integrate_plugins
log.debug("Adding blueprint %s:%s", bp["name"], bp["blueprint"].import_name)
TypeError: 'Blueprint' object is not subscriptable
{code}
*Existing Codeblock:*
{code:java}
# www/app.py, lines 138-153
def integrate_plugins():
"""Integrate plugins to the context"""
log = LoggingMixin().log
from airflow.plugins_manager import (
admin_views, flask_blueprints, menu_links)
for v in admin_views:
log.debug('Adding view %s', v.name)
admin.add_view(v)
for bp in flask_blueprints:
log.debug("Adding blueprint %s:%s", bp["name"],
bp["blueprint"].import_name)
app.register_blueprint(bp["blueprint"])
for ml in sorted(menu_links, key=lambda x: x.name):
log.debug('Adding menu link %s', ml.name)
admin.add_link(ml)
integrate_plugins()
{code}
Corrected Codeblock:
{code:java}
# www/app.py, lines 138-153
def integrate_plugins():
"""Integrate plugins to the context"""
log = LoggingMixin().log
from airflow.plugins_manager import (
admin_views, flask_blueprints, menu_links)
for v in admin_views:
log.debug('Adding view %s', v.name)
admin.add_view(v)
for bp in flask_blueprints:
log.debug("Adding blueprint %s:%s", bp.name, bp.import_name)
app.register_blueprint(bp)
for ml in sorted(menu_links, key=lambda x: x.name):
log.debug('Adding menu link %s', ml.name)
admin.add_link(ml)
integrate_plugins(){code}
> App.py Flask Blueprint registration causes webserver shutdown
> -------------------------------------------------------------
>
> Key: AIRFLOW-4304
> URL: https://issues.apache.org/jira/browse/AIRFLOW-4304
> Project: Apache Airflow
> Issue Type: Bug
> Components: ui
> Affects Versions: 1.10.3
> Environment: macosx
> Reporter: Andrew Piermarini
> Priority: Major
> Labels: blueprint, flask, ui
> Fix For: 1.10.4
>
>
> Flask Blueprint objects are treated as subscriptable in `app.py`, which
> raises an exception that causes the webserver to shut down.
> The exception is raised on line 147 of /airflow/www/app.py. In prior
> versions, the Blueprint object was retrieved from a dictionary-like
> flask_blueprints object by calling bp["blueprint"]. As of 10.3, it appears
> that flask_blueprints is loaded as an array of non-subscriptable Blueprint
> objects on which `name` and `import_name` can be called directly.
>
> *Exception:*
> {code:java}
> [2019-04-11 15:09:02 -0700] [54143] [ERROR] Exception in worker process
> Traceback (most recent call last):
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/arbiter.py",
> line 583, in spawn_worker
> worker.init_process()
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/workers/base.py",
> line 129, in init_process
> self.load_wsgi()
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/workers/base.py",
> line 138, in load_wsgi
> self.wsgi = self.app.wsgi()
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/base.py",
> line 67, in wsgi
> self.callable = self.load()
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",
> line 52, in load
> return self.load_wsgiapp()
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",
> line 41, in load_wsgiapp
> return util.import_app(self.app_uri)
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/gunicorn/util.py",
> line 362, in import_app
> app = eval(obj, vars(mod))
> File "<string>", line 1, in <module>
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
> line 192, in cached_app
> app = create_app(config, testing)
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
> line 153, in create_app
> integrate_plugins()
> File
> "/Users/andrew/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/airflow/www/app.py",
> line 147, in integrate_plugins
> log.debug("Adding blueprint %s:%s", bp["name"], bp["blueprint"].import_name)
> TypeError: 'Blueprint' object is not subscriptable
> {code}
> *Existing Codeblock:*
>
> {code:java}
> # www/app.py, lines 138-153
> def integrate_plugins():
> """Integrate plugins to the context"""
> log = LoggingMixin().log
> from airflow.plugins_manager import (
> admin_views, flask_blueprints, menu_links)
> for v in admin_views:
> log.debug('Adding view %s', v.name)
> admin.add_view(v)
> for bp in flask_blueprints:
> log.debug("Adding blueprint %s:%s", bp["name"],
> bp["blueprint"].import_name)
> app.register_blueprint(bp["blueprint"])
> for ml in sorted(menu_links, key=lambda x: x.name):
> log.debug('Adding menu link %s', ml.name)
> admin.add_link(ml)
> integrate_plugins()
> {code}
>
> Corrected Codeblock:
> {code:java}
> # www/app.py, lines 138-153
> def integrate_plugins():
> """Integrate plugins to the context"""
> log = LoggingMixin().log
> from airflow.plugins_manager import (
> admin_views, flask_blueprints, menu_links)
> for v in admin_views:
> log.debug('Adding view %s', v.name)
> admin.add_view(v)
> for bp in flask_blueprints:
> log.debug("Adding blueprint %s:%s", bp.name, bp.import_name)
> app.register_blueprint(bp)
> for ml in sorted(menu_links, key=lambda x: x.name):
> log.debug('Adding menu link %s', ml.name)
> admin.add_link(ml)
> integrate_plugins(){code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)