def get_backend(): if "CLUSTER_BACKEND" in environ: return environ["CLUSTER_BACKEND"] if which("scontrol") is not None: environ["CLUSTER_BACKEND"] = "slurm" return ("slurm") elif which("qstat") is not None: environ["CLUSTER_BACKEND"] = "torque" return ("torque") else: raise(RuntimeError("No suitable cluster backend found."))
def __find_module_cmd(): """ Return first path that leads to a module command, or exit with no module loader found in the current environment. """ module_cmd = which("modulecmd") if module_cmd: lines = module_cmd.splitlines() if lines[0].startswith("alias"): return (findall("([^']*)", lines[0])) else: return (lines[0]) else: raise (RuntimeError("No 'modulecmd' found in current environment"))