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
3a6fdaa2
Commit
3a6fdaa2
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Catch more exceptions.
parent
be024151
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/scheduler_functions.py
+26
-19
26 additions, 19 deletions
app/scheduler_functions.py
with
26 additions
and
19 deletions
app/scheduler_functions.py
+
26
−
19
View file @
3a6fdaa2
...
@@ -42,25 +42,22 @@ def checkout_jobs():
...
@@ -42,25 +42,22 @@ def checkout_jobs():
mem_reservation
=
job
.
mem_mb
*
(
10
**
6
)
mem_reservation
=
job
.
mem_mb
*
(
10
**
6
)
)
)
_restart_policy
=
docker
.
types
.
RestartPolicy
(
condition
=
'
none
'
)
_restart_policy
=
docker
.
types
.
RestartPolicy
(
condition
=
'
none
'
)
'''
try
:
'
Create the service with the prepared values.
service
=
client
.
services
.
create
(
'
_image
,
'
Note: A service reserves hardware ressources. In case no worker
command
=
_command
,
'
node has the required ressources available (not reserved),
constraints
=
_constraints
,
'
the service gets queued by the Docker engine until a node
labels
=
_labels
,
'
is able to meet the requirements.
mounts
=
_mounts
,
'''
name
=
_name
,
service
=
client
.
services
.
create
(
resources
=
_resources
,
_image
,
restart_policy
=
_restart_policy
command
=
_command
,
)
constraints
=
_constraints
,
job
.
status
=
'
scheduled
'
labels
=
_labels
,
except
docker
.
errors
.
APIError
:
mounts
=
_mounts
,
job
.
status
=
'
failed
'
name
=
_name
,
print
(
'
[ERROR] {}: client.services.create raised APIError
'
resources
=
_resources
,
.
format
(
job
.
id
))
restart_policy
=
_restart_policy
)
job
.
status
=
'
scheduled
'
for
job
in
jobs
.
filter
(
Job
.
status
!=
'
complete
'
,
for
job
in
jobs
.
filter
(
Job
.
status
!=
'
complete
'
,
Job
.
status
!=
'
failed
'
,
Job
.
status
!=
'
failed
'
,
Job
.
status
!=
'
submitted
'
).
all
():
Job
.
status
!=
'
submitted
'
).
all
():
...
@@ -70,6 +67,16 @@ def checkout_jobs():
...
@@ -70,6 +67,16 @@ def checkout_jobs():
if
job
.
status
==
'
complete
'
or
job
.
status
==
'
failed
'
:
if
job
.
status
==
'
complete
'
or
job
.
status
==
'
failed
'
:
job
.
end_date
=
datetime
.
utcnow
()
job
.
end_date
=
datetime
.
utcnow
()
service
.
remove
()
service
.
remove
()
except
docker
.
errors
.
APIError
:
job
.
status
=
'
failed
'
print
(
'
[ERROR] {}: client.services.get raised APIError
'
.
format
(
job
.
id
))
except
docker
.
errors
.
NotFound
:
except
docker
.
errors
.
NotFound
:
job
.
status
=
'
failed
'
job
.
status
=
'
failed
'
print
(
'
[ERROR] {}: client.services.get raised NotFound
'
.
format
(
job
.
id
))
except
docker
.
errors
.
InvalidVersion
:
job
.
status
=
'
failed
'
print
(
'
[ERROR] {}: client.services.get raised InvalidVersion
'
.
format
(
job
.
id
))
db
.
session
.
commit
()
db
.
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