soravux / scoop

SCOOP (Scalable COncurrent Operations in Python)
https://github.com/soravux/scoop
GNU Lesser General Public License v3.0
636 stars 87 forks source link

Cannot use on a single node in a SLURM cluster #81

Open rgov opened 5 years ago

rgov commented 5 years ago
  File "scoop/utils.py", line 96, in externalHostname
    hostname = hosts[0][0]
IndexError: list index out of range

If I patch this to just use '127.0.0.1', I get:

    # Assure setup sanity
    assert type(hosts) == list and hosts, ("You should at least specify one host.")
rgov commented 5 years ago

The utils.parseSLURM function does not work with a single node.

rgov commented 5 years ago

Here's my replacement:

import subprocess
def parseSLURM(string):
    """Return a host list from a SLURM string"""
    out = subprocess.check_output(['scontrol', 'show', 'hostnames', string])
    hosts = [ (x.decode('utf-8'), 1) for x in out.rstrip().split(b'\n') ]
    return hosts