Commit 931decce authored by Manuel Günther's avatar Manuel Günther

Improved behavior when multiple jobs are re-submitted at the same time.

parent 4a1fbb81
......@@ -292,9 +292,9 @@ class Job(Base):
deps = str(sorted(list(set([dep.unique for dep in self.get_jobs_we_wait_for()]))))
if dependencies < len(deps):
deps = deps[:dependencies-3] + '...'
return format.format(self.unique, job_id, queue, status, self.name, deps, command_line)
return format.format(self.unique, job_id, queue[:12], status, self.name, deps, command_line)
else:
return format.format(self.unique, job_id, queue, status, self.name, command_line)
return format.format(self.unique, job_id, queue[:12], status, self.name, command_line)
......
......@@ -90,6 +90,14 @@ def get_ids(jobs):
return indexes
def get_memfree(memory, parallel):
"""Computes the memory required for the memfree field."""
number = int(memory.rstrip(string.ascii_letters))
memtype = memory.lstrip(string.digits)
if not memtype:
memtype = "G"
return "%d%s" % (number*parallel, memtype)
def submit(args):
"""Submission command"""
......@@ -115,7 +123,7 @@ def submit(args):
if args.qname != 'all.q': kwargs['hvmem'] = args.memory
if args.parallel is not None:
kwargs['pe_opt'] = "pe_mth %d" % args.parallel
kwargs['memfree'] = "%d%s" % (int(args.memory.rstrip(string.ascii_letters)) * args.parallel, args.memory.lstrip(string.digits))
kwargs['memfree'] = get_memfree(args.memory, args.parallel)
kwargs['dry_run'] = args.dry_run
kwargs['stop_on_failure'] = args.stop_on_failure
......@@ -140,7 +148,7 @@ def resubmit(args):
kwargs['hvmem'] = args.memory
if args.parallel is not None:
kwargs['pe_opt'] = "pe_mth %d" % args.parallel
kwargs['memfree'] = "%d%s" % (int(args.memory.rstrip(string.ascii_letters)) * args.parallel, args.memory.lstrip(string.digits))
kwargs['memfree'] = get_memfree(args.memory, args.parallel)
if args.io_big:
kwargs['io_big'] = True
if args.no_io_big:
......
......@@ -154,7 +154,8 @@ class JobManagerSGE(JobManager):
logger.debug("Re-submitting job '%s' with dependencies '%s' to the grid." % (job, deps))
self._submit_to_grid(job, job.name, job.get_array(), deps, job.log_dir, **arguments)
self.session.commit()
# commit after each job to avoid failures of not finding the job during execution in the grid
self.session.commit()
self.unlock()
......
......@@ -9,7 +9,7 @@ if sys.version_info[:2] < (2, 7) or ((3,0) <= sys.version_info[:2] < (3,2)):
setup(
name='gridtk',
version='1.1.3a0',
version='1.1.4a0',
description='SGE Grid and Local Submission and Monitoring Tools for Idiap',
url='http://github.com/idiap/gridtk',
......
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