Skip to content

Commit

Permalink
Merge 5689c57 into 495d9b5
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego committed May 11, 2018
2 parents 495d9b5 + 5689c57 commit c17057b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions reana_workflow_controller/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@

"""REANA Workflow Controller Instance."""

from flask import current_app

from reana_workflow_controller.factory import create_app

app = create_app()


@app.teardown_appcontext
def shutdown_session(response_or_exc):
"""Close session on app teardown."""
current_app.session.remove()
return response_or_exc
2 changes: 2 additions & 0 deletions reana_workflow_controller/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from __future__ import absolute_import

from flask import Flask
from reana_commons.database import Session

from reana_commons.models import Base # isort:skip # noqa

Expand All @@ -40,4 +41,5 @@ def create_app(config_mapping=None):
# Register API routes
from .rest import restapi_blueprint # noqa
app.register_blueprint(restapi_blueprint, url_prefix='/api')
app.session = Session
return app
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wdb
ipdb
Flask-DebugToolbar
-e git+git://github.com/reanahub/reana-commons.git#egg=reana-commons
git+git://github.com/reanahub/reana-commons.git#egg=reana-commons

0 comments on commit c17057b

Please sign in to comment.