Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dask_jobqueue/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down