Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gridtk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
software
gridtk
Commits
07a414d5
Commit
07a414d5
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Local scheduler now returns list of failed job ids.
parent
5b8b8c2d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gridtk/local.py
+9
-0
9 additions, 0 deletions
gridtk/local.py
gridtk/manager.py
+2
-2
2 additions, 2 deletions
gridtk/manager.py
with
11 additions
and
2 deletions
gridtk/local.py
+
9
−
0
View file @
07a414d5
...
...
@@ -169,6 +169,7 @@ class JobManagerLocal(JobManager):
def
run_scheduler
(
self
,
parallel_jobs
=
1
,
job_ids
=
None
,
sleep_time
=
0.1
,
die_when_finished
=
False
,
no_log
=
False
,
nice
=
None
):
"""
Starts the scheduler, which is constantly checking for jobs that should be ran.
"""
running_tasks
=
[]
finished_tasks
=
set
()
try
:
# keep the scheduler alive until every job is finished or the KeyboardInterrupt is caught
...
...
@@ -190,6 +191,7 @@ class JobManagerLocal(JobManager):
result
=
"
%s (%d)
"
%
(
job
.
status
,
job
.
result
)
if
job
.
result
is
not
None
else
"
%s (?)
"
%
job
.
status
self
.
unlock
()
logger
.
info
(
"
Job
'
%s
'
finished execution with result %s
"
%
(
self
.
_format_log
(
job_id
,
array_id
),
result
))
finished_tasks
.
add
(
job_id
)
# in any case, remove the job from the list
del
running_tasks
[
task_index
]
...
...
@@ -262,3 +264,10 @@ class JobManagerLocal(JobManager):
self
.
stop_job
(
task
[
1
])
# stop all jobs that are currently running or queued
self
.
stop_jobs
(
job_ids
)
# check the result of the jobs that we have run, and return the list of failed jobs
self
.
lock
()
jobs
=
self
.
get_jobs
(
finished_tasks
)
failures
=
[
job
.
unique
for
job
in
jobs
if
job
.
status
!=
'
success
'
]
self
.
unlock
()
return
sorted
(
failures
)
This diff is collapsed.
Click to expand it.
gridtk/manager.py
+
2
−
2
View file @
07a414d5
...
...
@@ -180,7 +180,7 @@ class JobManager:
print
(
"
WARNING: Stopped dependent jobs
'
%s
'
since this job failed.
"
%
str
(
deps
),
file
=
sys
.
stderr
)
except
Exception
as
e
:
print
(
"
ERROR: Caught exception
'
%s
'"
%
e
)
print
(
"
ERROR: Caught exception
'
%s
'"
%
e
,
file
=
sys
.
stderr
)
pass
finally
:
if
hasattr
(
self
,
'
session
'
):
...
...
@@ -240,8 +240,8 @@ class JobManager:
def
_write_contents
(
job
):
# Writes the contents of the output and error files to command line
out_file
,
err_file
=
job
.
std_out_file
(),
job
.
std_err_file
()
logger
.
info
(
"
Contents of output file:
'
%s
'"
%
out_file
)
if
output
and
out_file
is
not
None
and
os
.
path
.
exists
(
out_file
)
and
os
.
stat
(
out_file
).
st_size
>
0
:
logger
.
info
(
"
Contents of output file:
'
%s
'"
%
out_file
)
print
(
open
(
out_file
).
read
().
rstrip
())
print
(
"
-
"
*
20
)
if
error
and
err_file
is
not
None
and
os
.
path
.
exists
(
err_file
)
and
os
.
stat
(
err_file
).
st_size
>
0
:
...
...
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