import re


def parse_slurm_output(string):
    """Parses the output of slurm sbatch command into slurm job id and cluster name"""
    job_id = None
    cluster = None
    regex = 'Submitted batch job ([0-9]+) on cluster ([_a-zA-Z0-9]+).*'
    regex = re.search(regex, string)
    if regex:
        job_id = regex.group(1)
        cluster = regex.group(2)
    else:
        return (-1, '')

    return(int(job_id), str(cluster))