INNER CODE UNIT · Python

get_slurm_nodes

veg/hyphy · contrib/slurm_cpu_detect.py:6

def get_slurm_nodes():
    try:
        # Get all unique nodes in the cluster
        output = subprocess.check_output(["sinfo", "-h", "-o", "%n"], text=True)
        return list(set(output.split()))
    except (subprocess.CalledProcessError, FileNotFoundError):
        return []

def get_node_flags(nodes):
    if not nodes:
        return None

    # Bypassing srun as requested. We assume cluster homogeneity and 
    # use the local node's CPU flags as a proxy for the entire cluster.
    try:
        flags = set()
        with open("/proc/cpuinfo", "r") as f:
            for line in f:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…