Codestyle update

This commit is contained in:
Patrick Jentsch 2019-11-25 10:12:39 +01:00
parent dd469386e1
commit 3d8d2b3e48
3 changed files with 5 additions and 7 deletions

View File

@ -23,7 +23,7 @@ def create_app(config_name):
db.init_app(app) db.init_app(app)
login_manager.init_app(app) login_manager.init_app(app)
mail.init_app(app) mail.init_app(app)
socketio.init_app(app, message_qeue='redis://') socketio.init_app(app, message_qeue='redis://redis')
from . import events from . import events

View File

@ -72,7 +72,6 @@ def corpus_analysis(message):
def corpus_analysis_session_handler(app, corpus_id, session_id): def corpus_analysis_session_handler(app, corpus_id, session_id):
with app.app_context(): with app.app_context():
''' Setup analysis session ''' ''' Setup analysis session '''
logger.warning('[{}] Setup analysis session'.format(session_id))
corpus = Corpus.query.get(corpus_id) corpus = Corpus.query.get(corpus_id)
while corpus.status != 'analysing': while corpus.status != 'analysing':
db.session.refresh(corpus) db.session.refresh(corpus)
@ -84,13 +83,12 @@ def corpus_analysis_session_handler(app, corpus_id, session_id):
corpus_analysis_sessions[corpus_id] = [session_id] corpus_analysis_sessions[corpus_id] = [session_id]
else: else:
corpus_analysis_sessions[corpus_id].append(session_id) corpus_analysis_sessions[corpus_id].append(session_id)
socketio.emit('request_corpus_analysis', '[201]: Created', room=session_id) socketio.emit('request_corpus_analysis', '[201]: Created',
room=session_id)
''' Observe analysis session ''' ''' Observe analysis session '''
while session_id in connected_sessions: while session_id in connected_sessions:
logger.warning('[{}] Observe analysis session'.format(session_id))
socketio.sleep(3) socketio.sleep(3)
''' Teardown analysis session ''' ''' Teardown analysis session '''
logger.warning('[{}] Teardown analysis session'.format(session_id))
client.disconnect() client.disconnect()
corpus_analysis_clients.pop(session_id, None) corpus_analysis_clients.pop(session_id, None)
corpus_analysis_sessions[corpus_id].remove(session_id) corpus_analysis_sessions[corpus_id].remove(session_id)

View File

@ -1,8 +1,8 @@
from app import db, logger from app import db
from app.jobs.forms import AddNLPJobForm, AddOCRJobForm from app.jobs.forms import AddNLPJobForm, AddOCRJobForm
from app.models import Job, JobInput from app.models import Job, JobInput
from flask import (abort, current_app, flash, make_response, render_template, from flask import (abort, current_app, flash, make_response, render_template,
request, url_for) url_for)
from flask_login import current_user, login_required from flask_login import current_user, login_required
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
from . import services from . import services