Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set -N=1/--nodes=1 for SLURM workers #680

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion dask_jobqueue/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def __init__(
if account is not None:
header_lines.append("#SBATCH -A %s" % account)

# Init resources, always 1 task,
# Init resources, always 1 task, 1 node,
# and then number of cpu is processes * threads if not set
header_lines.append("#SBATCH -n 1")
header_lines.append("#SBATCH -N 1")
header_lines.append(
"#SBATCH --cpus-per-task=%d" % (job_cpu or self.worker_cores)
)
Expand Down
4 changes: 4 additions & 0 deletions dask_jobqueue/tests/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_header():
assert "#SBATCH" in cluster.job_header
assert "#SBATCH -J dask-worker" in cluster.job_header
assert "#SBATCH -n 1" in cluster.job_header
assert "#SBATCH -N 1" in cluster.job_header
assert "#SBATCH --cpus-per-task=8" in cluster.job_header
assert "#SBATCH --mem=27G" in cluster.job_header
assert "#SBATCH -t 00:02:00" in cluster.job_header
Expand All @@ -61,6 +62,7 @@ def test_header():
assert "#SBATCH" in cluster.job_header
assert "#SBATCH -J " in cluster.job_header
assert "#SBATCH -n 1" in cluster.job_header
assert "#SBATCH -N 1" in cluster.job_header
assert "#SBATCH -t " in cluster.job_header
assert "#SBATCH -p" not in cluster.job_header
# assert "#SBATCH -A" not in cluster.job_header
Expand All @@ -76,6 +78,7 @@ def test_job_script():
formatted_bytes = format_bytes(parse_bytes("7GB")).replace(" ", "")
assert f"--memory-limit {formatted_bytes}" in job_script
assert "#SBATCH -n 1" in job_script
assert "#SBATCH -N 1" in cluster.job_header
assert "#SBATCH --cpus-per-task=8" in job_script
assert "#SBATCH --mem=27G" in job_script
assert "#SBATCH -t 00:02:00" in job_script
Expand Down Expand Up @@ -108,6 +111,7 @@ def test_job_script():
assert "#SBATCH" in job_script
assert "#SBATCH -J dask-worker" in job_script
assert "#SBATCH -n 1" in job_script
assert "#SBATCH -N 1" in cluster.job_header
assert "#SBATCH --cpus-per-task=8" in job_script
assert "#SBATCH --mem=27G" in job_script
assert "#SBATCH -t 00:02:00" in job_script
Expand Down
Loading