Commit 07a414d5 authored by Manuel Günther's avatar Manuel Günther
Browse files

Local scheduler now returns list of failed job ids.

parent 5b8b8c2d
......@@ -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()
# 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()"Job '%s' finished execution with result %s" % (self._format_log(job_id, array_id), result))
# in any case, remove the job from the list
del running_tasks[task_index]
......@@ -262,3 +264,10 @@ class JobManagerLocal(JobManager):
# stop all jobs that are currently running or queued
# check the result of the jobs that we have run, and return the list of failed jobs
jobs = self.get_jobs(finished_tasks)
failures = [job.unique for job in jobs if job.status != 'success']
return sorted(failures)
......@@ -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)
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()"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:"Contents of output file: '%s'" % out_file)
if error and err_file is not None and os.path.exists(err_file) and os.stat(err_file).st_size > 0:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment