mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Set up all things for first query
This commit is contained in:
parent
414ebc73ff
commit
47440880d5
@ -27,13 +27,13 @@ def recv_query(message):
|
|||||||
|
|
||||||
def observe_corpus_analysis_connection(app, corpus_id, session_id):
|
def observe_corpus_analysis_connection(app, corpus_id, session_id):
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
cqi_client = CQiClient(host='172.25.0.2')
|
cqi_client = CQiClient(host=corpus.analysis_container_ip)
|
||||||
while session_id in connected_sessions:
|
while session_id in connected_sessions:
|
||||||
logger.warning(cqi_client.ctrl_ping())
|
logger.warning(cqi_client.ctrl_ping())
|
||||||
logger.warning('Run container, run!')
|
logger.warning('Run container, run!')
|
||||||
socketio.sleep(3)
|
socketio.sleep(3)
|
||||||
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
|
||||||
corpus.status = 'stop analysis'
|
corpus.status = 'stop analysis'
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
logger.warning('Stop container, stop!')
|
logger.warning('Stop container, stop!')
|
||||||
|
@ -442,7 +442,8 @@ class Corpus(db.Model):
|
|||||||
status = db.Column(db.String(16))
|
status = db.Column(db.String(16))
|
||||||
title = db.Column(db.String(32))
|
title = db.Column(db.String(32))
|
||||||
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
||||||
analysis_ip = db.Column(db.String(16))
|
analysis_container_ip = db.Column(db.String(16))
|
||||||
|
analysis_container_name = db.Column(db.String(32))
|
||||||
# Relationships
|
# Relationships
|
||||||
files = db.relationship('CorpusFile',
|
files = db.relationship('CorpusFile',
|
||||||
backref='corpus',
|
backref='corpus',
|
||||||
|
@ -61,11 +61,14 @@
|
|||||||
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
|
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
|
||||||
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
|
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
|
||||||
statusElement.innerText = status;
|
statusElement.innerText = status;
|
||||||
if (status === 'prepared' || status === 'start analysis' || status === 'analysing') {
|
var analyseBtn = document.getElementById('analyse');
|
||||||
var analyseBtn = document.getElementById('analyse');
|
if (status === 'prepared') {
|
||||||
|
analyseBtn.classList.remove('hide', 'disabled');
|
||||||
|
} else if (status === 'analysing' || status === 'start analysis' || status === 'stop analysis') {
|
||||||
analyseBtn.classList.remove('hide');
|
analyseBtn.classList.remove('hide');
|
||||||
|
analyseBtn.classList.add('disabled');
|
||||||
}
|
}
|
||||||
if (status === 'prepared' || status === 'start analysis' || status === 'analysing') {
|
if (status === 'prepared' || status === 'start analysis' || status === 'analysing' || status === 'stop analysis') {
|
||||||
var prepareBtn = document.getElementById('prepare');
|
var prepareBtn = document.getElementById('prepare');
|
||||||
prepareBtn.classList.add('hide');
|
prepareBtn.classList.add('hide');
|
||||||
}
|
}
|
||||||
|
32
migrations/versions/776761fb7466_.py
Normal file
32
migrations/versions/776761fb7466_.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 776761fb7466
|
||||||
|
Revises: 0aa38a7973c5
|
||||||
|
Create Date: 2019-11-07 08:34:01.676055
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '776761fb7466'
|
||||||
|
down_revision = '0aa38a7973c5'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('corpora', sa.Column('analysis_container_ip', sa.String(length=16), nullable=True))
|
||||||
|
op.add_column('corpora', sa.Column('analysis_container_name', sa.String(length=32), nullable=True))
|
||||||
|
op.drop_column('corpora', 'analysis_ip')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('corpora', sa.Column('analysis_ip', sa.VARCHAR(length=16), autoincrement=False, nullable=True))
|
||||||
|
op.drop_column('corpora', 'analysis_container_name')
|
||||||
|
op.drop_column('corpora', 'analysis_container_ip')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user