From 3d365e0ffdf3a80ebd9c97200aad5990d5673bfe Mon Sep 17 00:00:00 2001 From: leej3 Date: Fri, 23 Mar 2018 11:51:43 -0400 Subject: [PATCH] fix slurm config when queue not specified --- dask_jobqueue/slurm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dask_jobqueue/slurm.py b/dask_jobqueue/slurm.py index 8828239d..e95b60c7 100644 --- a/dask_jobqueue/slurm.py +++ b/dask_jobqueue/slurm.py @@ -2,6 +2,8 @@ import os import socket import sys +import subprocess +import re from distributed import LocalCluster from distributed.utils import get_ip_interface @@ -108,6 +110,17 @@ def __init__(self, "or set SLURM_ACCOUNT environment variable") self.cluster = LocalCluster(n_workers=0, ip=host, **kwargs) memory = memory.replace(' ', '') + if not queue: + try: + queues = subprocess.check_output(['sinfo -o "%P"'], + shell=True, + universal_newlines=True) + # Look for the queue that ends with * (the default queue) + queue = re.search(r'\w*\*', queues).group(0)[:-1] + except Exception as e: + print(e, "No queue specified and a default could not be found") + raise e + self.config = {'name': name, 'queue': queue, 'project': project,