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
f65ab646
Commit
f65ab646
authored
3 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
implement fixed version numbers
parent
2f9ecf80
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
web/app/services/__init__.py
+9
-9
9 additions, 9 deletions
web/app/services/__init__.py
web/app/tasks/job_utils.py
+31
-18
31 additions, 18 deletions
web/app/tasks/job_utils.py
with
40 additions
and
27 deletions
web/app/services/__init__.py
+
9
−
9
View file @
f65ab646
...
@@ -8,12 +8,12 @@ SERVICES = {
...
@@ -8,12 +8,12 @@ SERVICES = {
'
file-setup
'
:
{
'
file-setup
'
:
{
'
name
'
:
'
File setup
'
,
'
name
'
:
'
File setup
'
,
'
versions
'
:
{
'
versions
'
:
{
'
latest
'
:
'
1.0.0
'
,
'
latest
'
:
'
1.0.0
b
'
,
'
1.0.0
'
:
{
'
1.0.0
b
'
:
{
'
publishing_data
'
:
{
'
publishing_data
'
:
{
'
date
'
:
None
,
'
date
'
:
None
,
'
title
'
:
'
nopaque File setup service
'
,
'
title
'
:
'
nopaque File setup service
'
,
'
url
'
:
'
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/file-setup/-/tree/1.0.0
'
,
# noqa
'
url
'
:
'
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/file-setup/-/tree/1.0.0
b
'
,
# noqa
'
version
'
:
'
1.0.0
'
'
version
'
:
'
1.0.0
'
}
}
}
}
...
@@ -22,8 +22,8 @@ SERVICES = {
...
@@ -22,8 +22,8 @@ SERVICES = {
'
nlp
'
:
{
'
nlp
'
:
{
'
name
'
:
'
Natural Language Processing
'
,
'
name
'
:
'
Natural Language Processing
'
,
'
versions
'
:
{
'
versions
'
:
{
'
latest
'
:
'
1.0.0
'
,
'
latest
'
:
'
1.0.0
b
'
,
'
1.0.0
'
:
{
'
1.0.0
b
'
:
{
'
check_encoding
'
:
True
,
'
check_encoding
'
:
True
,
'
models
'
:
{
'
models
'
:
{
'
de
'
:
'
German
'
,
'
de
'
:
'
German
'
,
...
@@ -36,7 +36,7 @@ SERVICES = {
...
@@ -36,7 +36,7 @@ SERVICES = {
'
publishing_data
'
:
{
'
publishing_data
'
:
{
'
date
'
:
None
,
'
date
'
:
None
,
'
title
'
:
'
nopaque NLP service
'
,
'
title
'
:
'
nopaque NLP service
'
,
'
url
'
:
'
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nlp/-/tree/1.0.0
'
,
# noqa
'
url
'
:
'
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nlp/-/tree/1.0.0
b
'
,
# noqa
'
version
'
:
'
1.0.0
'
'
version
'
:
'
1.0.0
'
}
}
}
}
...
@@ -45,8 +45,8 @@ SERVICES = {
...
@@ -45,8 +45,8 @@ SERVICES = {
'
ocr
'
:
{
'
ocr
'
:
{
'
name
'
:
'
Optical Character Recognition
'
,
'
name
'
:
'
Optical Character Recognition
'
,
'
versions
'
:
{
'
versions
'
:
{
'
latest
'
:
'
1.0.0
'
,
'
latest
'
:
'
1.0.0
b
'
,
'
1.0.0
'
:
{
'
1.0.0
b
'
:
{
'
binarization
'
:
True
,
'
binarization
'
:
True
,
'
models
'
:
{
'
models
'
:
{
'
ara
'
:
'
Arabic
'
,
'
ara
'
:
'
Arabic
'
,
...
@@ -67,7 +67,7 @@ SERVICES = {
...
@@ -67,7 +67,7 @@ SERVICES = {
'
publishing_data
'
:
{
'
publishing_data
'
:
{
'
date
'
:
None
,
'
date
'
:
None
,
'
title
'
:
'
nopaque OCR service
'
,
'
title
'
:
'
nopaque OCR service
'
,
'
url
'
:
'
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/ocr/-/tree/1.0.0
'
,
# noqa
'
url
'
:
'
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/ocr/-/tree/1.0.0
b
'
,
# noqa
'
version
'
:
'
1.0.0
'
'
version
'
:
'
1.0.0
'
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
web/app/tasks/job_utils.py
+
31
−
18
View file @
f65ab646
...
@@ -9,20 +9,22 @@ import json
...
@@ -9,20 +9,22 @@ import json
import
os
import
os
# TODO: Integrate the service_settings into app/services/__init__.py
service_settings
=
{
service_settings
=
{
'
file-setup
'
:
{
'
file-setup
'
:
{
'
ressources
'
:
docker
.
types
.
Resources
(
mem_reservation
=
1024
*
(
10
**
6
),
'
default_args
'
:
'
--mem-mb 2048 --n-cores 2
'
,
cpu_reservation
=
1
*
(
10
**
9
))
'
ressources
'
:
docker
.
types
.
Resources
(
cpu_reservation
=
2
*
(
10
**
9
),
mem_reservation
=
2048
*
(
10
**
6
))
},
},
'
nlp
'
:
{
'
nlp
'
:
{
'
default_args
'
:
'
--
n-cores 2 --mem-mb 2048
'
,
'
default_args
'
:
'
--
mem-mb 2048 --n-cores 2
'
,
'
ressources
'
:
docker
.
types
.
Resources
(
mem
_reservation
=
2
048
*
(
10
**
6
),
'
ressources
'
:
docker
.
types
.
Resources
(
cpu
_reservation
=
2
*
(
10
**
9
),
cpu
_reservation
=
2
*
(
10
**
9
))
mem
_reservation
=
2
048
*
(
10
**
6
))
},
},
'
ocr
'
:
{
'
ocr
'
:
{
'
default_args
'
:
'
--
n-cores 4 --mem-mb 4096
'
,
'
default_args
'
:
'
--
mem-mb 4096 --n-cores 4
'
,
'
ressources
'
:
docker
.
types
.
Resources
(
mem
_reservation
=
4
096
*
(
10
**
6
),
'
ressources
'
:
docker
.
types
.
Resources
(
cpu
_reservation
=
4
*
(
10
**
9
),
cpu
_reservation
=
4
*
(
10
**
9
))
mem
_reservation
=
4
096
*
(
10
**
6
))
}
}
}
}
...
@@ -42,25 +44,36 @@ class CheckJobsMixin:
...
@@ -42,25 +44,36 @@ class CheckJobsMixin:
self
.
remove_job_service
(
job
)
self
.
remove_job_service
(
job
)
def
create_job_service
(
self
,
job
):
def
create_job_service
(
self
,
job
):
cmd
=
'
{} -i /files -o /files/output
'
.
format
(
job
.
service
)
cmd
=
job
.
service
if
'
default_args
'
in
service_settings
[
job
.
service
]:
cmd
+=
'
-i /input
'
cmd
+=
service_settings
[
job
.
service
][
'
default_args
'
]
cmd
+=
'
-o /output
'
if
job
.
service
==
'
file-setup
'
:
cmd
+=
'
--log-dir /input
'
cmd
+=
'
-f {}
'
.
format
(
secure_filename
(
job
.
title
))
cmd
+=
'
--log-dir /files
'
cmd
+=
'
--zip [{}]_{}
'
.
format
(
job
.
service
,
secure_filename
(
job
.
title
))
cmd
+=
'
--zip [{}]_{}
'
.
format
(
job
.
service
,
secure_filename
(
job
.
title
))
cmd
+=
service_settings
[
job
.
service
][
'
default_args
'
]
cmd
+=
'
'
+
'
'
.
join
(
json
.
loads
(
job
.
service_args
))
cmd
+=
'
'
+
'
'
.
join
(
json
.
loads
(
job
.
service_args
))
ressources
=
service_settings
[
job
.
service
][
'
ressources
'
]
# Setup input mount
input_mount_src
=
job
.
path
input_mount_dest
=
os
.
path
.
abspath
(
'
/input
'
)
if
job
.
service
==
'
file-setup
'
:
input_mount_dest
=
os
.
path
.
join
(
input_mount_dest
,
secure_filename
(
job
.
title
))
# noqa
input_mount
=
'
{}:{}:rw
'
.
format
(
input_mount_src
,
input_mount_dest
)
# Setup output mount
output_mount_src
=
os
.
path
.
join
(
job
.
path
,
'
output
'
)
output_mount_dest
=
os
.
path
.
abspath
(
'
/output
'
)
os
.
makedirs
(
output_mount_src
)
output_mount
=
'
{}:{}:rw
'
.
format
(
output_mount_src
,
output_mount_dest
)
logging
.
warning
(
input_mount
)
logging
.
warning
(
output_mount
)
service_kwargs
=
{
'
command
'
:
cmd
,
service_kwargs
=
{
'
command
'
:
cmd
,
'
constraints
'
:
[
'
node.role==worker
'
],
'
constraints
'
:
[
'
node.role==worker
'
],
'
labels
'
:
{
'
origin
'
:
'
nopaque
'
,
'
labels
'
:
{
'
origin
'
:
'
nopaque
'
,
'
type
'
:
'
job
'
,
'
type
'
:
'
job
'
,
'
job_id
'
:
str
(
job
.
id
)},
'
job_id
'
:
str
(
job
.
id
)},
'
mounts
'
:
[
job
.
path
+
'
:/files:rw
'
],
'
mounts
'
:
[
input_mount
,
output_mount
],
'
name
'
:
'
job_{}
'
.
format
(
job
.
id
),
'
name
'
:
'
job_{}
'
.
format
(
job
.
id
),
'
resources
'
:
ressources
,
'
resources
'
:
service_settings
[
job
.
service
][
'
ressources
'
],
# noqa
'
restart_policy
'
:
docker
.
types
.
RestartPolicy
()}
'
restart_policy
'
:
docker
.
types
.
RestartPolicy
()}
service_image
=
'
gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/{}:
latest
'
.
format
(
job
.
service
)
# noqa
service_image
=
'
gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/{}:
{}
'
.
format
(
job
.
service
,
job
.
service_version
)
# noqa
try
:
try
:
self
.
docker
.
services
.
create
(
service_image
,
**
service_kwargs
)
self
.
docker
.
services
.
create
(
service_image
,
**
service_kwargs
)
except
docker
.
errors
.
APIError
as
e
:
except
docker
.
errors
.
APIError
as
e
:
...
...
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