Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
e0a15140
Commit
e0a15140
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Plain Diff
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
parents
9be33ffc
03b956c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/corpora/events.py
+16
-13
16 additions, 13 deletions
app/corpora/events.py
app/events.py
+0
-1
0 additions, 1 deletion
app/events.py
with
16 additions
and
14 deletions
app/corpora/events.py
+
16
−
13
View file @
e0a15140
...
...
@@ -5,14 +5,14 @@ from flask import current_app, request
from
flask_login
import
login_required
from
.CQiWrapper.CQiWrapper
import
CQiWrapper
import
logging
import
time
analysis_clients
=
{}
@socketio.on
(
'
init_corpus_analysis
'
)
@login_required
def
init_corpus_analysis
(
corpus_id
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
warning
(
'
init_corpus_analysis
'
)
'''
TODO: Check if current_user is allowed to subscribe to this
'''
socketio
.
start_background_task
(
observe_corpus_analysis_connection
,
current_app
.
_get_current_object
(),
...
...
@@ -24,28 +24,31 @@ def init_corpus_analysis(corpus_id):
def
recv_query
(
message
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
warning
(
message
)
analysis_client
=
analysis_clients
[
request
.
sid
]
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_session
=
CQiWrapper
(
username
=
'
opaque
'
,
password
=
'
opaque
'
,
host
=
corpus
.
analysis_container_ip
,
port
=
4877
)
cqi_session
.
connect
()
logger
.
warning
(
cqi_session
.
corpus_list_corpora
())
while
corpus
.
status
!=
'
analysing
'
:
db
.
session
.
refresh
(
corpus
)
socketio
.
sleep
(
3
)
analysis_client
=
CQiWrapper
(
username
=
'
opaque
'
,
password
=
'
opaque
'
,
host
=
'
{}_analysis_container{}
'
.
format
(
corpus
.
creator
.
username
,
corpus
.
id
),
port
=
4877
)
analysis_clients
[
session_id
]
=
analysis_client
analysis_client
.
connect
()
logger
.
warning
(
analysis_client
.
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
)
analysis_client
.
create_attribute_strings
(
corpus_name
)
logger
.
warning
(
'
Log after create_attribute_strings.
'
)
cqi_session
.
query_subcorpus
(
corpus_name
,
result_subcorpus_name
,
query
)
analysis_client
.
query_subcorpus
(
corpus_name
,
result_subcorpus_name
,
query
)
logger
.
warning
(
'
Log after query_subcorpus.
'
)
while
session_id
in
connected_sessions
:
logger
.
warning
(
'
Run container, run!
'
)
logger
.
warning
(
analysis_client
.
ctrl_ping
()
)
socketio
.
sleep
(
3
)
analysis_clients
.
pop
(
session_id
,
None
)
corpus
.
status
=
'
stop analysis
'
db
.
session
.
commit
()
logger
.
warning
(
'
Stop container, stop!
'
)
This diff is collapsed.
Click to expand it.
app/events.py
+
0
−
1
View file @
e0a15140
...
...
@@ -5,7 +5,6 @@ from .decorators import admin_required
from
.models
import
User
import
json
import
jsonpatch
import
logging
'''
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment