Example #1
0
    def dictionate(self, d):
        """
        Take dict with tuple keys (value, int_member, str_protocol) and build
        a tree-like dict of dicts in which the values of d can be accessed
        like::
          d[value][int_member][str_protocol]

        @param d: the raw results accumulated from the slave nodes
        @type d: dict

        @return: tree-like dict ordered by variable value, member, protocol
        @rtype: dict of dict of dict of dict
        """
        r = {}

        keys = d.keys()

        ## only convert single value tuple keys into non-tuple keys
        if len(keys[0]) == 1:
            for k in keys:
                r[k[0]] = d[k]
            return r

        x_values = MU.nonredundant([k[0] for k in keys])

        for x in x_values:

            sub_keys = [k for k in keys if k[0] == x]
            y_values = MU.nonredundant([k[1:] for k in sub_keys])

            r[x] = {}
            for y in y_values:
                r[x][y] = d[(x, ) + y]

            r[x] = self.dictionate(r[x])

        return r
Example #2
0
    def dictionate( self, d ):
        """
        Take dict with tuple keys (value, int_member, str_protocol) and build
        a tree-like dict of dicts in which the values of d can be accessed
        like::
          d[value][int_member][str_protocol]

        @param d: the raw results accumulated from the slave nodes
        @type d: dict

        @return: tree-like dict ordered by variable value, member, protocol
        @rtype: dict of dict of dict of dict
        """
        r = {}

        keys = d.keys()

        ## only convert single value tuple keys into non-tuple keys
        if len( keys[0] ) == 1:
            for k in keys:
                r[ k[0] ] = d[ k ]
            return r

        x_values = MU.nonredundant( [ k[0] for k in keys ] )

        for x in x_values:

            sub_keys = [ k for k in keys if k[0] == x ]
            y_values = MU.nonredundant( [ k[1:] for k in sub_keys] )

            r[ x ] = {}
            for y in y_values:
                r[x][y] = d[ (x,) + y ]

            r[ x ] = self.dictionate( r[x] )

        return r
Example #3
0
for k in [
        'debug', 'verbose', 'cast', 'clean', 'w', 'all', 'heavy', 'jack',
        'protein'
]:
    if k in options:
        options[k] = 1

for k in ['cr', 'exrec', 'exlig', 'excom']:
    if k in options:
        options[k] = t.toIntList(options[k])

if 'atoms' in options:
    options['atoms'] = t.toList(options['atoms'])

if 'single' in options:
    options['hosts'] = mu.nonredundant(options.get('hosts', hosts.cpus_all))

if 'h' in options:
    options['hosts'] = options.get('hosts', hosts.cpus_all)[:options['h']]

if 'mem' in options:
    ram = hosts.ram_dic
    cpus = options.get('hosts', hosts.cpus_all)
    options['hosts'] = []
    for h in cpus:
        if ram.get(h, ram['default']) >= options['mem']:
            options['hosts'] += [h]
            ram[h] = ram.get(h, 0) - options['mem']

## ## initialize
master = AmberEntropyMaster(**options)
Example #4
0
        options[k] = float( options[k] )

for k in ['debug', 'verbose', 'cast', 'clean', 'w', 'all', 'heavy', 'jack',
          'protein']:
    if k in options:
        options[k] = 1

for k in [ 'cr', 'exrec', 'exlig', 'excom']:
    if k in options:
        options[k] = t.toIntList( options[k] )

if 'atoms' in options:
    options['atoms'] = t.toList( options['atoms'] )

if 'single' in options:
    options['hosts'] = mu.nonredundant( options.get('hosts', hosts.cpus_all) )

if 'h' in options:
    options['hosts'] = options.get('hosts', hosts.cpus_all)[ : options['h'] ]

if 'mem' in options:
    ram = hosts.ram_dic
    cpus= options.get('hosts', hosts.cpus_all)
    options['hosts'] = []
    for h in cpus:
        if ram.get(h, ram['default']) >= options['mem']:
            options['hosts'] += [ h ]
            ram[h] = ram.get(h, 0 ) - options['mem']


## ## initialize