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
ad8a8a46
Commit
ad8a8a46
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
use job id for swarm run instead of job object
parent
a302d084
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/services/views.py
+2
-4
2 additions, 4 deletions
app/services/views.py
app/swarm.py
+6
-3
6 additions, 3 deletions
app/swarm.py
with
8 additions
and
7 deletions
app/services/views.py
+
2
−
4
View file @
ad8a8a46
...
@@ -48,8 +48,7 @@ def nlp():
...
@@ -48,8 +48,7 @@ def nlp():
'
NOTE: Using self created threads is just for testing purpose as
'
NOTE: Using self created threads is just for testing purpose as
'
there is no scheduler available.
'
there is no scheduler available.
'''
'''
db
.
session
.
expunge
(
nlp_job
)
thread
=
Thread
(
target
=
swarm
.
run
,
args
=
(
nlp_job
.
id
,))
thread
=
Thread
(
target
=
swarm
.
run
,
args
=
(
nlp_job
,))
thread
.
start
()
thread
.
start
()
flash
(
'
Job created!
'
)
flash
(
'
Job created!
'
)
return
redirect
(
url_for
(
'
services.nlp
'
))
return
redirect
(
url_for
(
'
services.nlp
'
))
...
@@ -101,8 +100,7 @@ def ocr():
...
@@ -101,8 +100,7 @@ def ocr():
'
NOTE: Using self created threads is just for testing purpose as
'
NOTE: Using self created threads is just for testing purpose as
'
there is no scheduler available.
'
there is no scheduler available.
'''
'''
db
.
session
.
expunge
(
ocr_job
)
thread
=
Thread
(
target
=
swarm
.
run
,
args
=
(
ocr_job
.
id
,))
thread
=
Thread
(
target
=
swarm
.
run
,
args
=
(
ocr_job
,))
thread
.
start
()
thread
.
start
()
flash
(
'
Job created!
'
)
flash
(
'
Job created!
'
)
return
redirect
(
url_for
(
'
services.ocr
'
))
return
redirect
(
url_for
(
'
services.ocr
'
))
...
...
This diff is collapsed.
Click to expand it.
app/swarm.py
+
6
−
3
View file @
ad8a8a46
...
@@ -30,10 +30,13 @@ class Swarm:
...
@@ -30,10 +30,13 @@ class Swarm:
'
¹ https://blog.alexellis.io/containers-on-swarm/
'
¹ https://blog.alexellis.io/containers-on-swarm/
'''
'''
def
run
(
self
,
job
):
def
run
(
self
,
job
_id
):
'''
'''
Input is a job
object. From this the _command is built
.
Input is a job
id
.
'''
'''
from
.models
import
Job
session
=
self
.
Session
()
job
=
session
.
query
(
Job
).
filter_by
(
id
=
job_id
).
first
()
# Prepare argument values needed for the service creation.
# Prepare argument values needed for the service creation.
service_args
=
json
.
loads
(
job
.
service_args
)
service_args
=
json
.
loads
(
job
.
service_args
)
_command
=
(
job
.
service
_command
=
(
job
.
service
...
@@ -98,9 +101,9 @@ class Swarm:
...
@@ -98,9 +101,9 @@ class Swarm:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
service
.
reload
()
service
.
reload
()
'''
'''
'
The following is scheduler work.
'
Poll the service until the job is completly executed.
'
Poll the service until the job is completly executed.
'''
'''
session
=
self
.
Session
()
session
.
add
(
job
)
session
.
add
(
job
)
job
.
status
=
'
running
'
job
.
status
=
'
running
'
session
.
commit
()
session
.
commit
()
...
...
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