Skip to content
Snippets Groups Projects
Commit 9be33ffc authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

Add first tr to implement VQiWrapper

parent 8e5e8408
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ from app.events import connected_sessions ...@@ -3,7 +3,7 @@ from app.events import connected_sessions
from app.models import Corpus from app.models import Corpus
from flask import current_app, request from flask import current_app, request
from flask_login import login_required from flask_login import login_required
from .CQiClient.CQiClient import CQiClient from .CQiWrapper.CQiWrapper import CQiWrapper
import logging import logging
import time import time
...@@ -32,10 +32,18 @@ def observe_corpus_analysis_connection(app, corpus_id, session_id): ...@@ -32,10 +32,18 @@ def observe_corpus_analysis_connection(app, corpus_id, session_id):
time.sleep(5) # wait for IP of container only for dev time.sleep(5) # wait for IP of container only for dev
corpus = Corpus.query.filter_by(id=corpus_id).first() corpus = Corpus.query.filter_by(id=corpus_id).first()
logger.warning('IP adress is: {}'.format(corpus.analysis_container_ip)) logger.warning('IP adress is: {}'.format(corpus.analysis_container_ip))
cqi_client = CQiClient(host=corpus.analysis_container_ip) cqi_session = CQiWrapper(username='opaque', password='opaque',
cqi_client.ctrl_connect('opaque', 'opaque') host=corpus.analysis_container_ip, port=4877)
cqi_session.connect()
logger.warning(cqi_session.corpus_list_corpora())
corpus_name = 'CORPUS'
result_subcorpus_name = 'Query-results' # should be set by the user somehow
query = '"and";'
cqi_session.create_attribute_strings(corpus_name)
logger.warning('Log after create_attribute_strings.')
cqi_session.query_subcorpus(corpus_name, result_subcorpus_name, query)
logger.warning('Log after query_subcorpus.')
while session_id in connected_sessions: while session_id in connected_sessions:
logger.warning(cqi_client.ctrl_ping())
logger.warning('Run container, run!') logger.warning('Run container, run!')
socketio.sleep(3) socketio.sleep(3)
corpus.status = 'stop analysis' corpus.status = 'stop analysis'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment