Commit 2f551ecc authored by Laurent EL SHAFEY's avatar Laurent EL SHAFEY
Browse files

Add mem_free support in qsub

parent a5bad66a
......@@ -133,12 +133,14 @@ class Job:
return "%d %s%s" % (value, translate[unit], plural)
def queue(self):
"""The hard resource_list comes like this: '<qname>=TRUE mem=128M'. To
"""The hard resource_list comes like this: '<qname>=TRUE,mem=128M'. To
process it we have to split it twice (spaces and then on '='), create a
dictionary and extract just the qname"""
if not 'hard resource_list' in self.data: return 'all.q'
return dict([reversed(k.split('=')) for k in self.data['hard resource_list'].split()])['TRUE']
d = dict([reversed(k.split('=')) for k in self.data['hard resource_list'].split(',')])
if not 'TRUE' in d: return 'all.q'
return d['TRUE']
def __std_filename__(self, indicator, instance):
......
......@@ -34,7 +34,7 @@ def makedirs_safe(fulldir):
else: raise
def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='',
stderr='', env=[], array=None, context='grid'):
stderr='', env=[], array=None, context='grid', mem_free=None):
"""Submits a shell job to a given grid queue
Keyword parameters:
......@@ -92,6 +92,10 @@ def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='',
dictionary in which case we just setup using that context instead of
probing for a new one, what can be fast.
mem_free
If set, it asks the queue for a node with a minimum amount of free memory
(cf. qsub -l mem_free=<...>)
Returns a list of job ids assigned to this job (integers)
"""
......@@ -100,6 +104,8 @@ def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='',
if isinstance(queue, str) and queue not in ('all.q', 'default'):
scmd += ['-l', queue]
if mem_free: scmd += ['-l', 'mem_free=%s' % mem_free]
if cwd: scmd += ['-cwd']
if name: scmd += ['-N', name]
......
Supports Markdown
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