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
6f8cef26
Commit
6f8cef26
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Map task states to job status. Colorize status badges on dashboard.
parent
267f86d3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/services/views.py
+2
-2
2 additions, 2 deletions
app/services/views.py
app/swarm.py
+8
-5
8 additions, 5 deletions
app/swarm.py
app/templates/main/dashboard.html.j2
+20
-10
20 additions, 10 deletions
app/templates/main/dashboard.html.j2
with
30 additions
and
17 deletions
app/services/views.py
+
2
−
2
View file @
6f8cef26
...
@@ -25,7 +25,7 @@ def ocr():
...
@@ -25,7 +25,7 @@ def ocr():
"
--skip-binarisation
"
],
"
--skip-binarisation
"
],
"
lang
"
:
new_ocr_job_form
.
language
.
data
,
"
lang
"
:
new_ocr_job_form
.
language
.
data
,
"
version
"
:
new_ocr_job_form
.
version
.
data
}),
"
version
"
:
new_ocr_job_form
.
version
.
data
}),
status
=
"
submitted
"
,
status
=
"
pending
"
,
title
=
new_ocr_job_form
.
title
.
data
)
title
=
new_ocr_job_form
.
title
.
data
)
db
.
session
.
add
(
ocr_job
)
db
.
session
.
add
(
ocr_job
)
db
.
session
.
commit
()
db
.
session
.
commit
()
...
@@ -74,7 +74,7 @@ def nlp():
...
@@ -74,7 +74,7 @@ def nlp():
service_args
=
json
.
dumps
({
"
args
"
:
[],
service_args
=
json
.
dumps
({
"
args
"
:
[],
"
lang
"
:
new_nlp_job_form
.
language
.
data
,
"
lang
"
:
new_nlp_job_form
.
language
.
data
,
"
version
"
:
new_nlp_job_form
.
version
.
data
}),
"
version
"
:
new_nlp_job_form
.
version
.
data
}),
status
=
"
submitted
"
,
status
=
"
pending
"
,
title
=
new_nlp_job_form
.
title
.
data
)
title
=
new_nlp_job_form
.
title
.
data
)
db
.
session
.
add
(
nlp_job
)
db
.
session
.
add
(
nlp_job
)
db
.
session
.
commit
()
db
.
session
.
commit
()
...
...
This diff is collapsed.
Click to expand it.
app/swarm.py
+
8
−
5
View file @
6f8cef26
...
@@ -101,16 +101,19 @@ class Swarm:
...
@@ -101,16 +101,19 @@ class Swarm:
'
Poll the service until the job is completly executed.
'
Poll the service until the job is completly executed.
'''
'''
session
=
self
.
Session
()
session
=
self
.
Session
()
job
.
status
=
'
running
'
session
.
add
(
job
)
session
.
commit
()
current_state
=
None
while
True
:
while
True
:
current_state
=
service
.
tasks
()[
0
].
get
(
'
Status
'
).
get
(
'
State
'
)
current_state
=
service
.
tasks
()[
0
].
get
(
'
Status
'
).
get
(
'
State
'
)
if
job
.
status
!=
current_state
:
if
current_state
==
'
complete
'
or
current_state
==
'
failed
'
:
job
.
status
=
current_state
session
.
add
(
job
)
session
.
commit
()
if
current_state
==
'
complete
'
:
break
break
time
.
sleep
(
1
)
time
.
sleep
(
1
)
service
.
reload
()
service
.
reload
()
job
.
status
=
current_state
session
.
add
(
job
)
session
.
commit
()
session
.
close
()
session
.
close
()
# Remove the service from the swarm.
# Remove the service from the swarm.
service
.
remove
()
service
.
remove
()
...
...
This diff is collapsed.
Click to expand it.
app/templates/main/dashboard.html.j2
+
20
−
10
View file @
6f8cef26
...
@@ -58,17 +58,27 @@
...
@@ -58,17 +58,27 @@
</div>
</div>
</li>
</li>
{% for job in current_user.jobs.all() %}
{% for job in current_user.jobs.all() %}
{% if job.service == 'nlp' %}
{% set service_icon = 'format_textdirection_l_to_r' %}
{% elif job.service =='ocr' %}
{% set service_icon = 'find_in_page' %}
{% else %}
{% set service_icon = 'help' %}
{% endif %}
{% if job.status == 'pending' %}
{% set badge_color = 'amber' %}
{% elif job.status =='running' %}
{% set badge_color = 'indigo' %}
{% elif job.status =='complete' %}
{% set badge_color = 'teal' %}
{% else %}
{% set badge_color = 'red' %}
{% endif %}
<li class="collection-item avatar">
<li class="collection-item avatar">
<i class="material-icons circle">
<i class="material-icons circle">{{ service_icon }}</i>
{% if job.service == 'nlp' %}
<span class="new badge {{ badge_color }}" data-badge-caption="">{{ job.status }}</span>
format_textdirection_l_to_r
{% elif job.service =='ocr' %}
find_in_page
{% else %}
help
{% endif %}
</i>
<span class="new badge teal" data-badge-caption="">{{ job.status }}</span>
<span class="title">{{ job.title }}</span>
<span class="title">{{ job.title }}</span>
<p>{{ job.description }}</p>
<p>{{ job.description }}</p>
</li>
</li>
...
...
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