clusterjob/backends/lsf.py
def resource_headers(self, jobscript):
        """Given a :class:`~clusterjob.JobScript` instance, return a list of
        lines that encode the resource requirements, to be added at the top of
        the rendered job script
        """
        resources = jobscript.resources
        lines = []
        cores_per_node = 1
        nodes = 1
        if 'ppn' in resources:
            cores_per_node *= resources['ppn']
        if 'threads' in resources:
            cores_per_node *= resources['threads']
        if 'nodes' in resources:
            nodes = resources['nodes']
        if len(set(['ppn', 'threads', 'nodes']).intersection(resources)) > 0:
            line = '%s -n %d' % (self.prefix, nodes*cores_per_node)
            if cores_per_node > 1:
                line += ' -R "span[ptile=%d]"' % cores_per_node
            lines.append(line)
        for (key, val) in resources.items():
            if key in ['nodes', 'ppn', 'threads']:
                continue
            if key in self.resource_replacements:
                lsf_key = self.resource_replacements[key]
                if key == 'time':
                    val = time_to_minutes(val)
            else:
                lsf_key = key
            if val is None:
                continue
            if type(val) is bool:
                if val:
                    lines.append("%s %s" % (self.prefix, lsf_key))
            else:
                lines.append("%s %s %s" % (self.prefix, lsf_key, str(val)))
        return lines
Given a :class:`~clusterjob.JobScript` instance, return a list of
        lines that encode the resource requirements, to be added at the top of
        the rendered job script
        
Given a :class:`~clusterjob.JobScript` instance, return a list of
lines that encode the resource requirements, to be added at the top of
the rendered job script
Given a : class : ` ~clusterjob . JobScript ` instance return a list of lines that encode the resource requirements to be added at the top of the rendered job script
def resource_headers(self, jobscript):
        resources = jobscript.resources
        lines = []
        cores_per_node = 1
        nodes = 1
        if 'ppn' in resources:
            cores_per_node *= resources['ppn']
        if 'threads' in resources:
            cores_per_node *= resources['threads']
        if 'nodes' in resources:
            nodes = resources['nodes']
        if len(set(['ppn', 'threads', 'nodes']).intersection(resources)) > 0:
            line = '%s -n %d' % (self.prefix, nodes*cores_per_node)
            if cores_per_node > 1:
                line += ' -R "span[ptile=%d]"' % cores_per_node
            lines.append(line)
        for (key, val) in resources.items():
            if key in ['nodes', 'ppn', 'threads']:
                continue
            if key in self.resource_replacements:
                lsf_key = self.resource_replacements[key]
                if key == 'time':
                    val = time_to_minutes(val)
            else:
                lsf_key = key
            if val is None:
                continue
            if type(val) is bool:
                if val:
                    lines.append("%s %s" % (self.prefix, lsf_key))
            else:
                lines.append("%s %s %s" % (self.prefix, lsf_key, str(val)))
        return lines
def resource_headers ( self , jobscript ) : resources = jobscript . resources lines = [ ] cores_per_node = 1 nodes = 1 if 'ppn' in resources : cores_per_node *= resources [ 'ppn' ] if 'threads' in resources : cores_per_node *= resources [ 'threads' ] if 'nodes' in resources : nodes = resources [ 'nodes' ] if len ( set ( [ 'ppn' , 'threads' , 'nodes' ] ) . intersection ( resources ) ) > 0 : line = '%s -n %d' % ( self . prefix , nodes * cores_per_node ) if cores_per_node > 1 : line += ' -R "span[ptile=%d]"' % cores_per_node lines . append ( line ) for ( key , val ) in resources . items ( ) : if key in [ 'nodes' , 'ppn' , 'threads' ] : continue if key in self . resource_replacements : lsf_key = self . resource_replacements [ key ] if key == 'time' : val = time_to_minutes ( val ) else : lsf_key = key if val is None : continue if type ( val ) is bool : if val : lines . append ( "%s %s" % ( self . prefix , lsf_key ) ) else : lines . append ( "%s %s %s" % ( self . prefix , lsf_key , str ( val ) ) ) return lines
Given a :class:`~clusterjob.JobScript` instance, return a list of
lines that encode the resource requirements, to be added at the top of
the rendered job script
Given a : class : ` ~clusterjob . JobScript ` instance return a list of lines that encode the resource requirements to be added at the top of the rendered job script
"""Given a :class:`~clusterjob.JobScript` instance, return a list of
        lines that encode the resource requirements, to be added at the top of
        the rendered job script
        """
self
jobscript