From 7233c74dcae3dc23e207f79b6350e96f1f565099 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 7 Nov 2019 13:56:21 +0100 Subject: [PATCH] Add some fixes --- app/corpora/events.py | 3 +++ app/events.py | 2 -- app/templates/corpora/corpus.html.j2 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/corpora/events.py b/app/corpora/events.py index 4132bbbf..36f9f34d 100644 --- a/app/corpora/events.py +++ b/app/corpora/events.py @@ -5,6 +5,7 @@ from flask import current_app, request from flask_login import login_required from .CQiClient.CQiClient import CQiClient import logging +import time @socketio.on('init_corpus_analysis') @@ -28,7 +29,9 @@ def recv_query(message): def observe_corpus_analysis_connection(app, corpus_id, session_id): logger = logging.getLogger(__name__) with app.app_context(): + time.sleep(5) # wait for IP of container only for dev corpus = Corpus.query.filter_by(id=corpus_id).first() + logger.warning('IP adress is: {}'.format(corpus.analysis_container_ip)) cqi_client = CQiClient(host=corpus.analysis_container_ip) cqi_client.ctrl_connect('opaque', 'opaque') while session_id in connected_sessions: diff --git a/app/events.py b/app/events.py index fc6b777e..b0ac4dc4 100644 --- a/app/events.py +++ b/app/events.py @@ -64,8 +64,6 @@ def user_ressource_subscription_handler(app, user_id, session_id, ' The JSON patches are send as update-* events. ' > where '*' is either 'corpora' or 'jobs' ''' - logger = logging.getLogger(__name__) - logger.warning('user_id: {}, foreign: {}'.format(user_id, foreign)) init_events = {'corpora': 'init-foreign-corpora' if foreign else 'init-corpora', 'jobs': 'init-foreign-jobs' if foreign else 'init-jobs'} diff --git a/app/templates/corpora/corpus.html.j2 b/app/templates/corpora/corpus.html.j2 index 7faee62c..adbe92c7 100644 --- a/app/templates/corpora/corpus.html.j2 +++ b/app/templates/corpora/corpus.html.j2 @@ -68,7 +68,7 @@ analyseBtn.classList.remove('hide'); analyseBtn.classList.add('disabled'); } - if (status === 'prepared' || status === 'start analysis' || status === 'analysing' || status === 'stop analysis') { + if (status === 'prepared' || status === 'preparable' || status === 'preparing' || status === 'start analysis' || status === 'analysing' || status === 'stop analysis') { var prepareBtn = document.getElementById('prepare'); prepareBtn.classList.add('hide'); }