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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
b0c2415f
You need to sign in or sign up before continuing.
Commit
b0c2415f
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Codestyle++
parent
ca8d438e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/events.py
+8
-8
8 additions, 8 deletions
app/events.py
with
8 additions
and
8 deletions
app/events.py
+
8
−
8
View file @
b0c2415f
...
@@ -59,13 +59,12 @@ def user_ressource_session_handler(app, user_id, session_id, foreign=False):
...
@@ -59,13 +59,12 @@ def user_ressource_session_handler(app, user_id, session_id, foreign=False):
'
NOTE: The initial values are send as a init events.
'
NOTE: The initial values are send as a init events.
'
The JSON patches are send as update events.
'
The JSON patches are send as update events.
'''
'''
init_events
=
{
'
corpora
'
:
'
foreign_corpora_init
'
if
foreign
init_events
=
\
else
'
corpora_init
'
,
{
'
corpora
'
:
'
foreign_corpora_init
'
if
foreign
else
'
corpora_init
'
,
'
jobs
'
:
'
foreign_jobs_init
'
if
foreign
else
'
jobs_init
'
}
'
jobs
'
:
'
foreign_jobs_init
'
if
foreign
else
'
jobs_init
'
}
update_events
=
{
'
corpora
'
:
'
foreign_corpora_update
'
if
foreign
update_events
=
\
else
'
corpora_update
'
,
{
'
corpora
'
:
'
foreign_corpora_update
'
if
foreign
else
'
corpora_update
'
,
'
jobs
'
:
'
foreign_jobs_update
'
if
foreign
'
jobs
'
:
'
foreign_jobs_update
'
if
foreign
else
'
jobs_update
'
}
else
'
jobs_update
'
}
with
app
.
app_context
():
with
app
.
app_context
():
# Gather current values from database.
# Gather current values from database.
user
=
User
.
query
.
get
(
user_id
)
user
=
User
.
query
.
get
(
user_id
)
...
@@ -77,7 +76,8 @@ def user_ressource_session_handler(app, user_id, session_id, foreign=False):
...
@@ -77,7 +76,8 @@ def user_ressource_session_handler(app, user_id, session_id, foreign=False):
socketio
.
emit
(
init_events
[
'
jobs
'
],
json
.
dumps
(
jobs
),
room
=
session_id
)
socketio
.
emit
(
init_events
[
'
jobs
'
],
json
.
dumps
(
jobs
),
room
=
session_id
)
while
session_id
in
connected_sessions
:
while
session_id
in
connected_sessions
:
# Get new values from the database
# Get new values from the database
new_corpora
=
{
corpus
.
id
:
corpus
.
to_dict
()
for
corpus
in
user
.
corpora
}
new_corpora
=
{
corpus
.
id
:
corpus
.
to_dict
()
for
corpus
in
user
.
corpora
}
new_jobs
=
{
job
.
id
:
job
.
to_dict
()
for
job
in
user
.
jobs
}
new_jobs
=
{
job
.
id
:
job
.
to_dict
()
for
job
in
user
.
jobs
}
# Compute JSON patches.
# Compute JSON patches.
corpora_patch
=
jsonpatch
.
JsonPatch
.
from_diff
(
corpora
,
new_corpora
)
corpora_patch
=
jsonpatch
.
JsonPatch
.
from_diff
(
corpora
,
new_corpora
)
...
...
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