mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 10:54:18 +00:00
Don't use container name as host for cqiclient
This commit is contained in:
parent
af89a5776f
commit
bcdc3721ef
@ -1,13 +1,14 @@
|
|||||||
from cqi import CQiClient
|
from cqi import CQiClient
|
||||||
from cqi.errors import CQiException
|
from cqi.errors import CQiException
|
||||||
from cqi.status import CQiStatus
|
from cqi.status import CQiStatus
|
||||||
from flask import session
|
from docker.models.containers import Container
|
||||||
|
from flask import current_app, session
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from flask_socketio import Namespace
|
from flask_socketio import Namespace
|
||||||
from inspect import signature
|
from inspect import signature
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import Callable, Dict, List, Optional
|
from typing import Callable, Dict, List, Optional
|
||||||
from app import db, hashids, socketio
|
from app import db, docker_client, hashids, socketio
|
||||||
from app.decorators import socketio_login_required
|
from app.decorators import socketio_login_required
|
||||||
from app.models import Corpus, CorpusStatus
|
from app.models import Corpus, CorpusStatus
|
||||||
from . import extensions
|
from . import extensions
|
||||||
@ -121,7 +122,10 @@ class CQiNamespace(Namespace):
|
|||||||
socketio.sleep(3)
|
socketio.sleep(3)
|
||||||
retry_counter -= 1
|
retry_counter -= 1
|
||||||
db.session.refresh(db_corpus)
|
db.session.refresh(db_corpus)
|
||||||
cqi_client: CQiClient = CQiClient(f'cqpserver_{db_corpus_id}')
|
cqpserver_container_name: str = f'cqpserver_{db_corpus_id}'
|
||||||
|
cqpserver_container: Container = docker_client.containers.get(cqpserver_container_name)
|
||||||
|
cqpserver_host: str = cqpserver_container.attrs['NetworkSettings']['Networks'][current_app.config['NOPAQUE_DOCKER_NETWORK_NAME']]['IPAddress']
|
||||||
|
cqi_client: CQiClient = CQiClient(cqpserver_host)
|
||||||
session['cqi_over_sio'] = {
|
session['cqi_over_sio'] = {
|
||||||
'cqi_client': cqi_client,
|
'cqi_client': cqi_client,
|
||||||
'cqi_client_lock': Lock(),
|
'cqi_client_lock': Lock(),
|
||||||
|
Loading…
Reference in New Issue
Block a user